drift-labs / gateway

Self hosted API gateway to easily interact with Drift V2 Protocol
Apache License 2.0
22 stars 12 forks source link

Requests to gateway causes error #75

Closed Kristex95 closed 1 month ago

Kristex95 commented 1 month ago

Recently, I've been using gateway and it worked fine. But suddenly every general endpoints started causing exceptions like this:

thread 'actix-rt|system:0|arbiter:0' panicked at ...cargo\git\checkouts\drift-rs-5caec46913ba7527\9d90de9\src\math\account_map_builder.rs:122:58: called Option::unwrap() on a None value

stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src\panicking.rs:645 1: core::panicking::panic_fmt at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\core\src\panicking.rs:72 2: core::panicking::panic at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\core\src\panicking.rs:144 3: drift_sdk::math::account_map_builder::AccountMapBuilder::build 4: drift_sdk::math::liquidation::calculate_collateral 5: actixweb::middleware::logger::::<impl core::ops::drop::Drop for actix_web::middleware::logger::StreamLog>::drop::__drop_inner::{{closure}} 6: <tokio::runtime::task::join::JoinHandle as core::ops::drop::Drop>::drop 7: <tokio::runtime::task::join::JoinHandle as core::ops::drop::Drop>::drop 8: <actix_web::middleware::logger::LoggerResponse<S,B> as core::future::future::Future>::poll 9: <actix_web::types::either::Either<L,R> as actix_web::response::responder::Responder>::respond_to 10: <actix_web::types::either::Either<L,R> as actix_web::response::responder::Responder>::respond_to 11: <actix_service::and_then::AndThenServiceResponse<A,B,Req> as core::future::future::Future>::poll 12: tokio::runtime::task::core::Core<T,S>::poll 13: tokio::runtime::task::harness::Harness<T,S>::poll 14: tokio::task::local::LocalSet::tick 15: <tokio::task::local::RunUntil as core::future::future::Future>::poll 16: <core::pin::Pin

as core::future::future::Future>::poll 17: tokio::runtime::scheduler::current_thread::Context::enter 18: tokio::runtime::context::scoped::Scoped::set 19: tokio::runtime::context::set_scheduler 20: tokio::runtime::scheduler::current_thread::CoreGuard::block_on 21: tokio::runtime::context::runtime::enter_runtime 22: tokio::runtime::runtime::Runtime::block_on note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

The endpoint used to produce error: /v2/collateral RPC node: https://mainnet.helius-rpc.com Public key: 6zuBS19Wtyof9EzWEinpsEJU2zPtXiHGCaxwwYT2URAR

It happens with other endpoint as well

Kristex95 commented 1 month ago

Also, I've created second wallet for test purpose. It didn't work. So the issue is not in the account

jordy25519 commented 1 month ago

thanks for reporting. it's likely due to rate limits being hit on startup as gateway tries to populate alot of data from chain. however the error should make this clearer and should find a way to make it more rate-limit friendly