Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
taslimmuhammed committed Nov 2, 2024
2 parents ebec51b + 7a5dca6 commit 9c6277c
Show file tree
Hide file tree
Showing 27 changed files with 505 additions and 313 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ jobs:
type=semver,pattern={{major}}.{{minor}},value=${{steps.extract_version.outputs.version}}
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{steps.extract_version.outputs.version}}
type=semver,pattern={{major}},value=${{steps.extract_version.outputs.version}}
type=semver,pattern=v{{version}},value=${{steps.extract_version.outputs.version}}
type=semver,pattern=v{{major}}.{{minor}},value=${{steps.extract_version.outputs.version}}
type=semver,pattern=v{{major}}.{{minor}}.{{patch}},value=${{steps.extract_version.outputs.version}}
type=semver,pattern=v{{major}},value=${{steps.extract_version.outputs.version}}
type=sha
- name: Log in to the Container registry
Expand All @@ -79,6 +83,6 @@ jobs:
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6
with:
context: ./
push: true
push: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
tags: ${{ steps.meta.outputs.tags }}
file: Dockerfile.${{ matrix.target }}
6 changes: 3 additions & 3 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"tap-agent": "1.4.1",
"common": "1.2.1",
"tap-agent": "1.5.0",
"common": "1.3.0",
"config": "1.2.0",
"service": "1.2.1"
"service": "1.2.2"
}
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.3.0](https://github.com/graphprotocol/indexer-rs/compare/indexer-common-v1.2.1...indexer-common-v1.3.0) (2024-11-01)


### Features

* enable value check ([#430](https://github.com/graphprotocol/indexer-rs/issues/430)) ([466a5a9](https://github.com/graphprotocol/indexer-rs/commit/466a5a92c66f5cd31f5aa9c20fb51cd0df391d6c))

## [1.2.1](https://github.com/graphprotocol/indexer-rs/compare/indexer-common-v1.2.0...indexer-common-v1.2.1) (2024-10-30)


Expand Down
2 changes: 1 addition & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "indexer-common"
version = "1.2.1"
version = "1.3.0"
edition = "2021"

[dependencies]
Expand Down
19 changes: 11 additions & 8 deletions common/src/allocations/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,22 @@ mod test {

use super::*;

fn network_subgraph_client() -> &'static SubgraphClient {
Box::leak(Box::new(SubgraphClient::new(
reqwest::Client::new(),
None,
DeploymentDetails::for_query_url(NETWORK_SUBGRAPH_URL).unwrap(),
)))
async fn network_subgraph_client() -> &'static SubgraphClient {
Box::leak(Box::new(
SubgraphClient::new(
reqwest::Client::new(),
None,
DeploymentDetails::for_query_url(NETWORK_SUBGRAPH_URL).unwrap(),
)
.await,
))
}

#[tokio::test]
#[ignore = "depends on the defunct hosted-service"]
async fn test_network_query() {
let result = get_allocations(
network_subgraph_client(),
network_subgraph_client().await,
Address::from_str("0x326c584e0f0eab1f1f83c93cc6ae1acc0feba0bc").unwrap(),
Duration::from_secs(1712448507),
)
Expand All @@ -158,7 +161,7 @@ mod test {
#[ignore = "depends on the defunct hosted-service"]
async fn test_network_query_empty_response() {
let result = get_allocations(
network_subgraph_client(),
network_subgraph_client().await,
Address::from_str("0xdeadbeefcafebabedeadbeefcafebabedeadbeef").unwrap(),
Duration::from_secs(1712448507),
)
Expand Down
3 changes: 2 additions & 1 deletion common/src/attestations/dispute_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ mod test {
*test_vectors::NETWORK_SUBGRAPH_DEPLOYMENT
))
.unwrap(),
);
)
.await;

// Mock result for current epoch requests
mock_server
Expand Down
23 changes: 13 additions & 10 deletions common/src/escrow_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,19 @@ mod tests {
async fn test_current_accounts() {
// Set up a mock escrow subgraph
let mock_server = MockServer::start().await;
let escrow_subgraph = Box::leak(Box::new(SubgraphClient::new(
reqwest::Client::new(),
None,
DeploymentDetails::for_query_url(&format!(
"{}/subgraphs/id/{}",
&mock_server.uri(),
*test_vectors::ESCROW_SUBGRAPH_DEPLOYMENT
))
.unwrap(),
)));
let escrow_subgraph = Box::leak(Box::new(
SubgraphClient::new(
reqwest::Client::new(),
None,
DeploymentDetails::for_query_url(&format!(
"{}/subgraphs/id/{}",
&mock_server.uri(),
*test_vectors::ESCROW_SUBGRAPH_DEPLOYMENT
))
.unwrap(),
)
.await,
));

let mock = Mock::given(method("POST"))
.and(path(format!(
Expand Down
104 changes: 56 additions & 48 deletions common/src/indexer_service/http/indexer_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,36 +200,39 @@ impl IndexerService {
.build()
.expect("Failed to init HTTP client");

let network_subgraph: &'static SubgraphClient = Box::leak(Box::new(SubgraphClient::new(
http_client.clone(),
options
.config
.subgraphs
.network
.config
.deployment_id
.map(|deployment| {
DeploymentDetails::for_graph_node_url(
options.config.graph_node.status_url.clone(),
options.config.graph_node.query_url.clone(),
deployment,
)
})
.transpose()
.expect(
"Failed to parse graph node query endpoint and network subgraph deployment",
),
DeploymentDetails::for_query_url_with_token(
options.config.subgraphs.network.config.query_url.as_ref(),
let network_subgraph: &'static SubgraphClient = Box::leak(Box::new(
SubgraphClient::new(
http_client.clone(),
options
.config
.subgraphs
.network
.config
.query_auth_token
.clone(),
)?,
)));
.deployment_id
.map(|deployment| {
DeploymentDetails::for_graph_node_url(
options.config.graph_node.status_url.clone(),
options.config.graph_node.query_url.clone(),
deployment,
)
})
.transpose()
.expect(
"Failed to parse graph node query endpoint and network subgraph deployment",
),
DeploymentDetails::for_query_url_with_token(
options.config.subgraphs.network.config.query_url.as_ref(),
options
.config
.subgraphs
.network
.config
.query_auth_token
.clone(),
)?,
)
.await,
));

// Identify the dispute manager for the configured network
let dispute_manager = dispute_manager(network_subgraph, Duration::from_secs(3600))
Expand Down Expand Up @@ -264,34 +267,39 @@ impl IndexerService {
dispute_manager,
);

let escrow_subgraph: &'static SubgraphClient = Box::leak(Box::new(SubgraphClient::new(
http_client,
options
.config
.subgraphs
.escrow
.config
.deployment_id
.map(|deployment| {
DeploymentDetails::for_graph_node_url(
options.config.graph_node.status_url.clone(),
options.config.graph_node.query_url.clone(),
deployment,
)
})
.transpose()
.expect("Failed to parse graph node query endpoint and escrow subgraph deployment"),
DeploymentDetails::for_query_url_with_token(
options.config.subgraphs.escrow.config.query_url.as_ref(),
let escrow_subgraph: &'static SubgraphClient = Box::leak(Box::new(
SubgraphClient::new(
http_client,
options
.config
.subgraphs
.escrow
.config
.query_auth_token
.clone(),
)?,
)));
.deployment_id
.map(|deployment| {
DeploymentDetails::for_graph_node_url(
options.config.graph_node.status_url.clone(),
options.config.graph_node.query_url.clone(),
deployment,
)
})
.transpose()
.expect(
"Failed to parse graph node query endpoint and escrow subgraph deployment",
),
DeploymentDetails::for_query_url_with_token(
options.config.subgraphs.escrow.config.query_url.as_ref(),
options
.config
.subgraphs
.escrow
.config
.query_auth_token
.clone(),
)?,
)
.await,
));

let escrow_accounts = escrow_accounts(
escrow_subgraph,
Expand Down
Loading

0 comments on commit 9c6277c

Please sign in to comment.