Skip to content

Commit e1f04cf

Browse files
authored
chains, graph: NoopRuntimeAdapter to reduce code duplication (#4424)
1 parent 7c8d78e commit e1f04cf

File tree

14 files changed

+38
-85
lines changed

14 files changed

+38
-85
lines changed

chain/arweave/src/chain.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use graph::blockchain::client::ChainClient;
22
use graph::blockchain::{
33
BasicBlockchainBuilder, Block, BlockchainBuilder, BlockchainKind, EmptyNodeCapabilities,
4+
NoopRuntimeAdapter,
45
};
56
use graph::cheap_clone::CheapClone;
67
use graph::data::subgraph::UnifiedMappingApiVersion;
@@ -24,7 +25,6 @@ use std::sync::Arc;
2425

2526
use crate::adapter::TriggerFilter;
2627
use crate::data_source::{DataSourceTemplate, UnresolvedDataSourceTemplate};
27-
use crate::runtime::RuntimeAdapter;
2828
use crate::trigger::{self, ArweaveTrigger};
2929
use crate::{
3030
codec,
@@ -170,7 +170,7 @@ impl Blockchain for Chain {
170170
}
171171

172172
fn runtime_adapter(&self) -> Arc<dyn RuntimeAdapterTrait<Self>> {
173-
Arc::new(RuntimeAdapter {})
173+
Arc::new(NoopRuntimeAdapter::default())
174174
}
175175

176176
fn chain_client(&self) -> Arc<ChainClient<Self>> {

chain/arweave/src/runtime/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
pub use runtime_adapter::RuntimeAdapter;
2-
31
pub mod abi;
4-
pub mod runtime_adapter;
52

63
mod generated;

chain/arweave/src/runtime/runtime_adapter.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

chain/cosmos/src/chain.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::sync::Arc;
22

33
use graph::blockchain::block_stream::FirehoseCursor;
44
use graph::blockchain::client::ChainClient;
5-
use graph::blockchain::{BasicBlockchainBuilder, BlockchainBuilder};
5+
use graph::blockchain::{BasicBlockchainBuilder, BlockchainBuilder, NoopRuntimeAdapter};
66
use graph::cheap_clone::CheapClone;
77
use graph::data::subgraph::UnifiedMappingApiVersion;
88
use graph::prelude::MetricsRegistry;
@@ -26,7 +26,6 @@ use crate::data_source::{
2626
DataSource, DataSourceTemplate, EventOrigin, UnresolvedDataSource, UnresolvedDataSourceTemplate,
2727
};
2828
use crate::trigger::CosmosTrigger;
29-
use crate::RuntimeAdapter;
3029
use crate::{codec, TriggerFilter};
3130

3231
pub struct Chain {
@@ -168,7 +167,7 @@ impl Blockchain for Chain {
168167
}
169168

170169
fn runtime_adapter(&self) -> Arc<dyn RuntimeAdapterTrait<Self>> {
171-
Arc::new(RuntimeAdapter {})
170+
Arc::new(NoopRuntimeAdapter::default())
172171
}
173172

174173
fn chain_client(&self) -> Arc<ChainClient<Self>> {

chain/cosmos/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ mod protobuf;
66
pub mod runtime;
77
mod trigger;
88

9-
pub use self::runtime::RuntimeAdapter;
10-
119
// ETHDEP: These concrete types should probably not be exposed.
1210
pub use data_source::{DataSource, DataSourceTemplate};
1311

chain/cosmos/src/runtime/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
pub use runtime_adapter::RuntimeAdapter;
2-
31
pub mod abi;
4-
pub mod runtime_adapter;
52

63
#[cfg(test)]
74
mod test {

chain/cosmos/src/runtime/runtime_adapter.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

chain/near/src/chain.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use graph::blockchain::client::ChainClient;
2-
use graph::blockchain::{BasicBlockchainBuilder, BlockchainBuilder, BlockchainKind};
2+
use graph::blockchain::{
3+
BasicBlockchainBuilder, BlockchainBuilder, BlockchainKind, NoopRuntimeAdapter,
4+
};
35
use graph::cheap_clone::CheapClone;
46
use graph::data::subgraph::UnifiedMappingApiVersion;
57
use graph::firehose::FirehoseEndpoint;
@@ -24,7 +26,6 @@ use std::sync::Arc;
2426

2527
use crate::adapter::TriggerFilter;
2628
use crate::data_source::{DataSourceTemplate, UnresolvedDataSourceTemplate};
27-
use crate::runtime::RuntimeAdapter;
2829
use crate::trigger::{self, NearTrigger};
2930
use crate::{
3031
codec,
@@ -214,7 +215,7 @@ impl Blockchain for Chain {
214215
}
215216

216217
fn runtime_adapter(&self) -> Arc<dyn RuntimeAdapterTrait<Self>> {
217-
Arc::new(RuntimeAdapter {})
218+
Arc::new(NoopRuntimeAdapter::default())
218219
}
219220

220221
fn chain_client(&self) -> Arc<ChainClient<Self>> {

chain/near/src/runtime/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
pub use runtime_adapter::RuntimeAdapter;
2-
31
pub mod abi;
4-
pub mod runtime_adapter;
52

63
mod generated;

chain/near/src/runtime/runtime_adapter.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)