Skip to content

Commit

Permalink
fix: remove irrelevant fields from deployment queries
Browse files Browse the repository at this point in the history
We may need to add these back later for other purposes, but
indexer-service does not need these fields; the only reason
it queries allocations is to create attestation signers for
them.

There might be even more fields that we could remove. However,
signalled_tokens in particular is necessary at the moment because
there is buggy data in the real-world network subgraph where the
field is negative sometimes. That breaks U256 parsing. Since
we don't need this and the other fields, I thought it best to
remove them.
  • Loading branch information
Jannis committed Oct 17, 2023
1 parent 93e9c95 commit 1d360ca
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 52 deletions.
6 changes: 0 additions & 6 deletions common/src/allocations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ pub struct SubgraphDeployment {
pub id: DeploymentId,
#[serde(rename = "deniedAt")]
pub denied_at: Option<u64>,
#[serde(rename = "stakedTokens")]
pub staked_tokens: U256,
#[serde(rename = "signalledTokens")]
pub signalled_tokens: U256,
#[serde(rename = "queryFeesAmount")]
pub query_fees_amount: U256,
}

impl<'d> Deserialize<'d> for Allocation {
Expand Down
6 changes: 0 additions & 6 deletions common/src/allocations/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ pub fn indexer_allocations(
subgraphDeployment {
id
deniedAt
stakedTokens
signalledTokens
queryFeesAmount
}
}
recentlyClosedAllocations: totalAllocations(
Expand All @@ -121,9 +118,6 @@ pub fn indexer_allocations(
subgraphDeployment {
id
deniedAt
stakedTokens
signalledTokens
queryFeesAmount
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions common/src/attestations/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ mod tests {
)
.unwrap(),
denied_at: None,
staked_tokens: U256::zero(),
signalled_tokens: U256::zero(),
query_fees_amount: U256::zero(),
},
indexer: Address::ZERO,
allocated_tokens: U256::zero(),
Expand Down Expand Up @@ -236,9 +233,6 @@ mod tests {
)
.unwrap(),
denied_at: None,
staked_tokens: U256::zero(),
signalled_tokens: U256::zero(),
query_fees_amount: U256::zero(),
},
indexer: Address::ZERO,
allocated_tokens: U256::zero(),
Expand Down
32 changes: 4 additions & 28 deletions common/src/test_vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ pub const ALLOCATIONS_QUERY_RESPONSE: &str = r#"
"closedAtEpoch": null,
"subgraphDeployment": {
"id": "0xbbde25a2c85f55b53b7698b9476610c3d1202d88870e66502ab0076b7218f98a",
"deniedAt": 0,
"stakedTokens": "96183284152000000014901161",
"signalledTokens": "182832939554154667498047",
"queryFeesAmount": "19861336072168874330350"
"deniedAt": 0
}
},
{
Expand All @@ -53,10 +50,7 @@ pub const ALLOCATIONS_QUERY_RESPONSE: &str = r#"
"closedAtEpoch": null,
"subgraphDeployment": {
"id": "0xcda7fa0405d6fd10721ed13d18823d24b535060d8ff661f862b26c23334f13bf",
"deniedAt": 0,
"stakedTokens": "53885041676589999979510903",
"signalledTokens": "104257136417832003117925",
"queryFeesAmount": "2229358609434396563687"
"deniedAt": 0
}
}
],
Expand All @@ -72,10 +66,7 @@ pub const ALLOCATIONS_QUERY_RESPONSE: &str = r#"
"closedAtEpoch": 953,
"subgraphDeployment": {
"id": "0xbbde25a2c85f55b53b7698b9476610c3d1202d88870e66502ab0076b7218f98a",
"deniedAt": 0,
"stakedTokens": "96183284152000000014901161",
"signalledTokens": "182832939554154667498047",
"queryFeesAmount": "19861336072168874330350"
"deniedAt": 0
}
},
{
Expand All @@ -89,10 +80,7 @@ pub const ALLOCATIONS_QUERY_RESPONSE: &str = r#"
"closedAtEpoch": 953,
"subgraphDeployment": {
"id": "0xc064c354bc21dd958b1d41b67b8ef161b75d2246b425f68ed4c74964ae705cbd",
"deniedAt": 0,
"stakedTokens": "85450761241000000055879354",
"signalledTokens": "154944508746646550301048",
"queryFeesAmount": "4293718622418791971020"
"deniedAt": 0
}
}
]
Expand Down Expand Up @@ -134,9 +122,6 @@ lazy_static! {
.unwrap(),
),
denied_at: Some(0),
staked_tokens: U256::from_str("96183284152000000014901161").unwrap(),
signalled_tokens: U256::from_str("182832939554154667498047").unwrap(),
query_fees_amount: U256::from_str("19861336072168874330350").unwrap(),
},
status: AllocationStatus::Null,
closed_at_epoch_start_block_hash: None,
Expand All @@ -163,9 +148,6 @@ lazy_static! {
.unwrap(),
),
denied_at: Some(0),
staked_tokens: U256::from_str("53885041676589999979510903").unwrap(),
signalled_tokens: U256::from_str("104257136417832003117925").unwrap(),
query_fees_amount: U256::from_str("2229358609434396563687").unwrap(),
},
status: AllocationStatus::Null,
closed_at_epoch_start_block_hash: None,
Expand All @@ -192,9 +174,6 @@ lazy_static! {
.unwrap(),
),
denied_at: Some(0),
staked_tokens: U256::from_str("96183284152000000014901161").unwrap(),
signalled_tokens: U256::from_str("182832939554154667498047").unwrap(),
query_fees_amount: U256::from_str("19861336072168874330350").unwrap(),
},
status: AllocationStatus::Null,
closed_at_epoch_start_block_hash: None,
Expand All @@ -221,9 +200,6 @@ lazy_static! {
.unwrap(),
),
denied_at: Some(0),
staked_tokens: U256::from_str("85450761241000000055879354").unwrap(),
signalled_tokens: U256::from_str("154944508746646550301048").unwrap(),
query_fees_amount: U256::from_str("4293718622418791971020").unwrap(),
},
status: AllocationStatus::Null,
closed_at_epoch_start_block_hash: None,
Expand Down
3 changes: 0 additions & 3 deletions service/src/query_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ mod tests {
let subgraph_deployment = SubgraphDeployment {
id: *DEPLOYMENT_ID,
denied_at: None,
staked_tokens: U256::from(0),
signalled_tokens: U256::from(0),
query_fees_amount: U256::from(0),
};

let indexer = Address::from_str(INDEXER_ADDRESS).unwrap();
Expand Down
3 changes: 0 additions & 3 deletions service/src/tap_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ mod test {
subgraph_deployment: SubgraphDeployment {
id: DeploymentId::from_str("QmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").unwrap(),
denied_at: None,
query_fees_amount: U256::zero(),
signalled_tokens: U256::zero(),
staked_tokens: U256::zero(),
},
status: AllocationStatus::Active,
allocated_tokens: U256::zero(),
Expand Down

0 comments on commit 1d360ca

Please sign in to comment.