Skip to content

Commit d1aeeb8

Browse files
committed
Merge branch 'master' into fix-compliance-issues-with-gql-server
2 parents b29fad3 + aa6677a commit d1aeeb8

File tree

113 files changed

+3261
-1824
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+3261
-1824
lines changed

Cargo.lock

Lines changed: 203 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repository = "https://github.com/graphprotocol/graph-node"
2121
license = "MIT OR Apache-2.0"
2222

2323
[workspace.dependencies]
24-
prost = "0.11.8"
24+
prost = "0.11.9"
2525
prost-types = "0.11.8"
2626
tonic = { version = "0.8.3", features = ["tls-roots", "gzip"] }
2727
tonic-build = { version = "0.8.4", features = ["prost"] }

chain/ethereum/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ graph-runtime-derive = { path = "../../runtime/derive" }
2626

2727
[dev-dependencies]
2828
base64 = "0.20.0"
29-
uuid = { version = "1.3.0", features = ["v4"] }
29+
uuid = { version = "1.3.1", features = ["v4"] }
3030

3131
[build-dependencies]
3232
tonic-build = { workspace = true }

chain/ethereum/src/runtime/abi.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,14 @@ impl FromAscObj<AscUnresolvedContractCall_0_0_4> for UnresolvedContractCall {
138138
asc_call: AscUnresolvedContractCall_0_0_4,
139139
heap: &H,
140140
gas: &GasCounter,
141+
depth: usize,
141142
) -> Result<Self, DeterministicHostError> {
142143
Ok(UnresolvedContractCall {
143-
contract_name: asc_get(heap, asc_call.contract_name, gas)?,
144-
contract_address: asc_get(heap, asc_call.contract_address, gas)?,
145-
function_name: asc_get(heap, asc_call.function_name, gas)?,
146-
function_signature: Some(asc_get(heap, asc_call.function_signature, gas)?),
147-
function_args: asc_get(heap, asc_call.function_args, gas)?,
144+
contract_name: asc_get(heap, asc_call.contract_name, gas, depth)?,
145+
contract_address: asc_get(heap, asc_call.contract_address, gas, depth)?,
146+
function_name: asc_get(heap, asc_call.function_name, gas, depth)?,
147+
function_signature: Some(asc_get(heap, asc_call.function_signature, gas, depth)?),
148+
function_args: asc_get(heap, asc_call.function_args, gas, depth)?,
148149
})
149150
}
150151
}
@@ -163,13 +164,14 @@ impl FromAscObj<AscUnresolvedContractCall> for UnresolvedContractCall {
163164
asc_call: AscUnresolvedContractCall,
164165
heap: &H,
165166
gas: &GasCounter,
167+
depth: usize,
166168
) -> Result<Self, DeterministicHostError> {
167169
Ok(UnresolvedContractCall {
168-
contract_name: asc_get(heap, asc_call.contract_name, gas)?,
169-
contract_address: asc_get(heap, asc_call.contract_address, gas)?,
170-
function_name: asc_get(heap, asc_call.function_name, gas)?,
170+
contract_name: asc_get(heap, asc_call.contract_name, gas, depth)?,
171+
contract_address: asc_get(heap, asc_call.contract_address, gas, depth)?,
172+
function_name: asc_get(heap, asc_call.function_name, gas, depth)?,
171173
function_signature: None,
172-
function_args: asc_get(heap, asc_call.function_args, gas)?,
174+
function_args: asc_get(heap, asc_call.function_args, gas, depth)?,
173175
})
174176
}
175177
}

chain/ethereum/src/runtime/runtime_adapter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ fn ethereum_call(
7777
// function signature; subgraphs using an apiVersion < 0.0.4 don't pass
7878
// the signature along with the call.
7979
let call: UnresolvedContractCall = if ctx.heap.api_version() >= Version::new(0, 0, 4) {
80-
asc_get::<_, AscUnresolvedContractCall_0_0_4, _>(ctx.heap, wasm_ptr.into(), &ctx.gas)?
80+
asc_get::<_, AscUnresolvedContractCall_0_0_4, _>(ctx.heap, wasm_ptr.into(), &ctx.gas, 0)?
8181
} else {
82-
asc_get::<_, AscUnresolvedContractCall, _>(ctx.heap, wasm_ptr.into(), &ctx.gas)?
82+
asc_get::<_, AscUnresolvedContractCall, _>(ctx.heap, wasm_ptr.into(), &ctx.gas, 0)?
8383
};
8484

8585
let result = eth_call(

chain/substreams/src/trigger.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use graph::{
77
store::{DeploymentLocator, EntityKey, EntityType, SubgraphFork},
88
subgraph::{MappingError, ProofOfIndexingEvent, SharedProofOfIndexing},
99
},
10-
data::store::scalar::Bytes,
10+
data::{store::scalar::Bytes, value::Word},
1111
data_source::{self, CausalityRegion},
1212
prelude::{
13-
anyhow, async_trait, BigDecimal, BigInt, BlockHash, BlockNumber, BlockState, Entity,
13+
anyhow, async_trait, BigDecimal, BigInt, BlockHash, BlockNumber, BlockState,
1414
RuntimeHostBuilder, Value,
1515
},
1616
slog::Logger,
@@ -189,7 +189,7 @@ where
189189
entity_id: entity_id.clone().into(),
190190
causality_region: CausalityRegion::ONCHAIN, // Substreams don't currently support offchain data
191191
};
192-
let mut data: HashMap<String, Value> = HashMap::from_iter(vec![]);
192+
let mut data: HashMap<Word, Value> = HashMap::from_iter(vec![]);
193193

194194
for field in entity_change.fields.iter() {
195195
let new_value: &codec::value::Typed = match &field.new_value {
@@ -200,21 +200,25 @@ where
200200
};
201201

202202
let value: Value = decode_value(new_value)?;
203-
*data.entry(field.name.clone()).or_insert(Value::Null) = value;
203+
*data
204+
.entry(Word::from(field.name.clone()))
205+
.or_insert(Value::Null) = value;
204206
}
205207

206208
write_poi_event(
207209
proof_of_indexing,
208210
&ProofOfIndexingEvent::SetEntity {
209211
entity_type,
210212
id: &entity_id,
213+
// TODO: This should be an entity so we do not have to build the intermediate HashMap
211214
data: &data,
212215
},
213216
causality_region,
214217
logger,
215218
);
216219

217-
state.entity_cache.set(key, Entity::from(data))?;
220+
let entity = state.entity_cache.make_entity(data)?;
221+
state.entity_cache.set(key, entity)?;
218222
}
219223
Operation::Delete => {
220224
let entity_type: &str = &entity_change.entity;

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ ipfs-api-backend-hyper = "0.6"
3636
ipfs-api = { version = "0.17.0", features = [
3737
"with-hyper-rustls",
3838
], default-features = false }
39-
uuid = { version = "1.3.0", features = ["v4"] }
39+
uuid = { version = "1.3.1", features = ["v4"] }

core/src/polling_monitor/ipfs_service.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn ipfs_service(
1717
client: IpfsClient,
1818
max_file_size: u64,
1919
timeout: Duration,
20-
concurrency_and_rate_limit: u16,
20+
rate_limit: u16,
2121
) -> IpfsService {
2222
let ipfs = IpfsServiceInner {
2323
client,
@@ -26,8 +26,7 @@ pub fn ipfs_service(
2626
};
2727

2828
let svc = ServiceBuilder::new()
29-
.rate_limit(concurrency_and_rate_limit.into(), Duration::from_secs(1))
30-
.concurrency_limit(concurrency_and_rate_limit as usize)
29+
.rate_limit(rate_limit.into(), Duration::from_secs(1))
3130
.service_fn(move |req| ipfs.cheap_clone().call_inner(req))
3231
.boxed();
3332

core/src/polling_monitor/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ where
161161

162162
// Object not found, push the id to the back of the queue.
163163
Ok((id, None)) => {
164+
debug!(logger, "not found on polling"; "object_id" => id.to_string());
165+
164166
metrics.not_found.inc();
165167
queue.push_back(id);
166168
}

core/src/subgraph/inputs.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,42 @@ pub struct IndexingInputs<C: Blockchain> {
3333
/// possibly expensive and noisy, information
3434
pub instrument: bool,
3535
}
36+
37+
impl<C: Blockchain> IndexingInputs<C> {
38+
pub fn with_store(&self, store: Arc<dyn WritableStore>) -> Self {
39+
let IndexingInputs {
40+
deployment,
41+
features,
42+
start_blocks,
43+
stop_block,
44+
store: _,
45+
debug_fork,
46+
triggers_adapter,
47+
chain,
48+
templates,
49+
unified_api_version,
50+
static_filters,
51+
poi_version,
52+
network,
53+
manifest_idx_and_name,
54+
instrument,
55+
} = self;
56+
IndexingInputs {
57+
deployment: deployment.clone(),
58+
features: features.clone(),
59+
start_blocks: start_blocks.clone(),
60+
stop_block: stop_block.clone(),
61+
store,
62+
debug_fork: debug_fork.clone(),
63+
triggers_adapter: triggers_adapter.clone(),
64+
chain: chain.clone(),
65+
templates: templates.clone(),
66+
unified_api_version: unified_api_version.clone(),
67+
static_filters: *static_filters,
68+
poi_version: *poi_version,
69+
network: network.clone(),
70+
manifest_idx_and_name: manifest_idx_and_name.clone(),
71+
instrument: *instrument,
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)