Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add value check #153

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Conversation

gusinacio
Copy link
Contributor

No description provided.

Signed-off-by: Gustavo Inacio <gustavo@semiotic.ai>
Copy link

github-actions bot commented Apr 19, 2024

Pull Request Test Coverage Report for Build 8759461513

Details

  • 0 of 149 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-2.0%) to 64.658%

Changes Missing Coverage Covered Lines Changed/Added Lines %
common/src/tap/checks/value_check.rs 0 149 0.0%
Totals Coverage Status
Change from base Build 8742451305: -2.0%
Covered Lines: 3251
Relevant Lines: 5028

💛 - Coveralls

Ok(())
} else {
return Err(anyhow!(
"Query receipt does not have the minimum value. Expected value: {}. Minimum value: {}.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Query receipt does not have the minimum value. Expected value: {}. Minimum value: {}.",
"Query receipt does not have the minimum value. Expected value: {}. Received value: {}.",

let request =
serde_json::from_slice(&body).map_err(|e| IndexerServiceError::InvalidRequest(e.into()))?;

let mut attestation_signer: Option<AttestationSigner> = None;

if let Some(receipt) = receipt.into_signed_receipt() {
let allocation_id = receipt.message.allocation_id;
let signature = receipt.signature;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how/why you're using the signature

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signature is the best "unique id" for a specific receipt. It is unique for a given receipt + signer.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought you wanted it to be unique per "SQL text" vs. unique per each query.


// get agora model for the allocation_id
let mut cache = self.cost_model_cache.lock().unwrap();
// on average, we'll have zero or one model
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect that we can get more than 1 model in the case the model was recently updated, and we are still in the period where expect the query to be priced according to a previous model or the new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, we'll have more than one model when recently updated. But I expect that this is not that often. That's the reason for my comment. On average we'll have one model, or even zero if it's not set.

@aasseman
Copy link
Collaborator

Having the cache in the indexer-service raises a small risk though.
We treat indexer-service as a stateless service. So in the case an indexer-service was recently started, it wouldn't be aware of previous recent agora models, and that could lead to wrongly rejecting queries.
However the only other solution to this would be to have the indexer DB do the caching of models, which could be annoying to implement.

@aasseman aasseman linked an issue Apr 29, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat.Req] Implement receipt value check
2 participants