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: Adds better handling for outdated VectorX contract state #36

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

moraesjeremias
Copy link
Member

@moraesjeremias moraesjeremias commented Mar 25, 2025

Changes

  • Adds better handling for outdated VectorX contract state

Reason for Change

  • Currently Turing Bridge API deployment is spamming several errors which are triggering our alerts.
    These errors could be mitigated by decreasing the severity of Succinct failed api responses log level, whenever VectorX contract block range is outdated (a mapped error case)

Tests

/eth/proof endpoint was debugged locally.
Log stream of cargo run (not debugger!):

╰─$ cargo run
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.87s
     Running `target/debug/bridge-api`
{"timestamp":"2025-03-25T10:41:50.923656Z","level":"INFO","fields":{"message":"🚀 Listening on 0.0.0.0 port 8080"},"target":"bridge_api"}
{"timestamp":"2025-03-25T10:41:50.923872Z","level":"INFO","fields":{"message":"Starting head tracking task"},"target":"bridge_api"}
{"timestamp":"2025-03-25T10:41:52.599249Z","level":"INFO","fields":{"message":"Beacon mapping: 7263616:7977457"},"target":"bridge_api"}
{"timestamp":"2025-03-25T10:41:58.311278Z","level":"DEBUG","fields":{"message":"started processing request"},"target":"tower_http::trace::on_request","span":{"method":"GET","uri":"/eth/proof/9b3cc74701006254c1fe9f16b65139c1ab8cbcef2ab50b409c69543573ea0929?index=1","version":"HTTP/1.1","name":"request"},"spans":[{"method":"GET","uri":"/eth/proof/9b3cc74701006254c1fe9f16b65139c1ab8cbcef2ab50b409c69543573ea0929?index=1","version":"HTTP/1.1","name":"request"}]}
{"timestamp":"2025-03-25T10:42:00.874029Z","level":"WARN","fields":{"message":"Succinct VectorX contract not updated yet, try again in a few minutes"},"target":"bridge_api","span":{"method":"GET","uri":"/eth/proof/9b3cc74701006254c1fe9f16b65139c1ab8cbcef2ab50b409c69543573ea0929?index=1","version":"HTTP/1.1","name":"request"},"spans":[{"method":"GET","uri":"/eth/proof/9b3cc74701006254c1fe9f16b65139c1ab8cbcef2ab50b409c69543573ea0929?index=1","version":"HTTP/1.1","name":"request"}]}
{"timestamp":"2025-03-25T10:42:00.874481Z","level":"DEBUG","fields":{"message":"finished processing request","latency":"2563 ms","status":425},"target":"tower_http::trace::on_response","span":{"method":"GET","uri":"/eth/proof/9b3cc74701006254c1fe9f16b65139c1ab8cbcef2ab50b409c69543573ea0929?index=1","version":"HTTP/1.1","name":"request"},"spans":[{"method":"GET","uri":"/eth/proof/9b3cc74701006254c1fe9f16b65139c1ab8cbcef2ab50b409c69543573ea0929?index=1","version":"HTTP/1.1","name":"request"}]}

src/main.rs Outdated
[("Cache-Control", "max-age=60, must-revalidate".to_string())],
Json(json!({ "error": data })),
);
match data.to_string().contains("is not in the range of blocks") {
Copy link
Member Author

Choose a reason for hiding this comment

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

If we come to an agreement that HTTP status code can be the same, then we may even simplify this to:

Suggested change
match data.to_string().contains("is not in the range of blocks") {
match data.to_string().contains("is not in the range of blocks") {
true => {
tracing::warn!("Succinct VectorX contract not updated yet, try again in a few minutes");
}
_ => {
tracing::error!("❌ Succinct API returned unsuccessfully");
}
}
return (
StatusCode::NOT_FOUND,
[("Cache-Control", "max-age=60, must-revalidate".to_string())],
Json(json!({ "error": data }))
)

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.

2 participants