drift-labs / gateway

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

SizeMismatch panic when trying to run gateway #55

Closed wildbunny closed 6 months ago

wildbunny commented 6 months ago

stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:645
   1: core::panicking::panic_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:72
   2: bytemuck::internal::something_went_wrong<bytemuck::PodCastError>
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bytemuck-1.15.0\src\internal.rs:32
   3: bytemuck::internal::from_bytes<drift::state::perp_market::PerpMarket>
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bytemuck-1.15.0\src\internal.rs:89
   4: bytemuck::from_bytes<drift::state::perp_market::PerpMarket>
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bytemuck-1.15.0\src\lib.rs:246
   5: drift::state::perp_market::impl$52::try_deserialize_unchecked
             at C:\Users\paul\.cargo\git\checkouts\protocol-v2-b91d1e7a5821079c\2bbe28c\programs\drift\src\state\perp_market.rs:157
   6: drift::state::perp_market::impl$52::try_deserialize
             at C:\Users\paul\.cargo\git\checkouts\protocol-v2-b91d1e7a5821079c\2bbe28c\programs\drift\src\state\perp_market.rs:157
   7: drift_sdk::utils::decode
             at C:\Users\paul\.cargo\git\checkouts\drift-rs-5caec46913ba7527\9b6252a\src\utils.rs:130
   8: drift_sdk::marketmap::impl$2::sync::async_fn$0<drift::state::perp_market::PerpMarket>
             at C:\Users\paul\.cargo\git\checkouts\drift-rs-5caec46913ba7527\9b6252a\src\marketmap.rs:221
   9: tokio::future::maybe_done::impl$1::poll<enum2$<drift_sdk::marketmap::impl$2::sync::async_fn_env$0<drift::state::perp_market::PerpMarket> > >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\future\maybe_done.rs:62
  10: drift_sdk::impl$6::new::async_fn$0::closure$0<drift_sdk::RpcAccountProvider>
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\macros\try_join.rs:172
  11: tokio::future::poll_fn::impl$1::poll<enum2$<core::result::Result<tuple$<tuple$<>,tuple$<>,solana_sdk::account::Account,solana_sdk::account::Account>,enum2$<drift_sdk::types::SdkError> > >,drift_sdk::impl$6::new::async_fn$0::closure_env$0<drift_sdk::RpcAcc
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\future\poll_fn.rs:58
  12: drift_sdk::impl$6::new::async_fn$0<drift_sdk::RpcAccountProvider>
             at C:\Users\paul\.cargo\git\checkouts\drift-rs-5caec46913ba7527\9b6252a\src\lib.rs:724
  13: drift_sdk::impl$5::new_with_opts::async_fn$0<drift_sdk::RpcAccountProvider>
             at C:\Users\paul\.cargo\git\checkouts\drift-rs-5caec46913ba7527\9b6252a\src\lib.rs:345
  14: drift_sdk::impl$5::new::async_fn$0<drift_sdk::RpcAccountProvider>
             at C:\Users\paul\.cargo\git\checkouts\drift-rs-5caec46913ba7527\9b6252a\src\lib.rs:334
  15: drift_gateway::controller::impl$0::new::async_fn$0
             at C:\temp\gateway-master\src\controller.rs:99
  16: drift_gateway::main::async_block$0
             at C:\temp\gateway-master\src\main.rs:239
  17: tokio::task::local::impl$10::poll::closure$0<enum2$<drift_gateway::main::async_block_env$0> >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\task\local.rs:978
  18: tokio::task::local::impl$4::with::closure$0<enum2$<core::task::poll::Poll<enum2$<core::result::Result<tuple$<>,std::io::error::Error> > > >,tokio::task::local::impl$10::poll::closure_env$0<enum2$<drift_gateway::main::async_block_env$0> > >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\task\local.rs:730
  19: std::thread::local::LocalKey<tokio::task::local::LocalData>::try_with<tokio::task::local::LocalData,tokio::task::local::impl$4::with::closure_env$0<enum2$<core::task::poll::Poll<enum2$<core::result::Result<tuple$<>,std::io::error::Error> > > >,tokio::task
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\std\src\thread\local.rs:284
  20: std::thread::local::LocalKey<tokio::task::local::LocalData>::with<tokio::task::local::LocalData,tokio::task::local::impl$4::with::closure_env$0<enum2$<core::task::poll::Poll<enum2$<core::result::Result<tuple$<>,std::io::error::Error> > > >,tokio::task::lo
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\std\src\thread\local.rs:260
  21: tokio::task::local::LocalSet::with<enum2$<core::task::poll::Poll<enum2$<core::result::Result<tuple$<>,std::io::error::Error> > > >,tokio::task::local::impl$10::poll::closure_env$0<enum2$<drift_gateway::main::async_block_env$0> > >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\task\local.rs:728
  22: tokio::task::local::impl$10::poll<enum2$<drift_gateway::main::async_block_env$0> >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\task\local.rs:968
  23: tokio::task::local::impl$4::run_until::async_fn$0<enum2$<drift_gateway::main::async_block_env$0> >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\task\local.rs:635
  24: core::future::future::impl$1::poll<ref_mut$<enum2$<tokio::task::local::impl$4::run_until::async_fn_env$0<enum2$<drift_gateway::main::async_block_env$0> > > > >
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\future\future.rs:123
  25: tokio::runtime::scheduler::current_thread::impl$8::block_on::closure$0::closure$0::closure$0<core::pin::Pin<ref_mut$<enum2$<tokio::task::local::impl$4::run_until::async_fn_env$0<enum2$<drift_gateway::main::async_block_env$0> > > > > >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\scheduler\current_thread\mod.rs:659
  26: tokio::runtime::coop::with_budget
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\coop.rs:107
  27: tokio::runtime::coop::budget
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\coop.rs:73
  28: tokio::runtime::scheduler::current_thread::impl$8::block_on::closure$0::closure$0<core::pin::Pin<ref_mut$<enum2$<tokio::task::local::impl$4::run_until::async_fn_env$0<enum2$<drift_gateway::main::async_block_env$0> > > > > >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\scheduler\current_thread\mod.rs:659
  29: tokio::runtime::scheduler::current_thread::Context::enter<enum2$<core::task::poll::Poll<enum2$<core::result::Result<tuple$<>,std::io::error::Error> > > >,tokio::runtime::scheduler::current_thread::impl$8::block_on::closure$0::closure_env$0<core::pin::Pin<
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\scheduler\current_thread\mod.rs:404
  30: tokio::runtime::scheduler::current_thread::impl$8::block_on::closure$0<core::pin::Pin<ref_mut$<enum2$<tokio::task::local::impl$4::run_until::async_fn_env$0<enum2$<drift_gateway::main::async_block_env$0> > > > > >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\scheduler\current_thread\mod.rs:658
  31: tokio::runtime::scheduler::current_thread::impl$8::enter::closure$0<tokio::runtime::scheduler::current_thread::impl$8::block_on::closure_env$0<core::pin::Pin<ref_mut$<enum2$<tokio::task::local::impl$4::run_until::async_fn_env$0<enum2$<drift_gateway::main:
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\scheduler\current_thread\mod.rs:737
  32: tokio::runtime::context::scoped::Scoped<enum2$<tokio::runtime::scheduler::Context> >::set<enum2$<tokio::runtime::scheduler::Context>,tokio::runtime::scheduler::current_thread::impl$8::enter::closure_env$0<tokio::runtime::scheduler::current_thread::impl$8:
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\context\scoped.rs:40
  33: tokio::runtime::context::set_scheduler::closure$0<tuple$<alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core,alloc::alloc::Global>,enum2$<core::option::Option<enum2$<core::result::Result<tuple$<>,std::io::error::Error> > > > >,tokio::runtime
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\context.rs:176
  34: std::thread::local::LocalKey<tokio::runtime::context::Context>::try_with<tokio::runtime::context::Context,tokio::runtime::context::set_scheduler::closure_env$0<tuple$<alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core,alloc::alloc::Global>,
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\std\src\thread\local.rs:284
  35: std::thread::local::LocalKey<tokio::runtime::context::Context>::with<tokio::runtime::context::Context,tokio::runtime::context::set_scheduler::closure_env$0<tuple$<alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core,alloc::alloc::Global>,enum
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\std\src\thread\local.rs:260
  36: tokio::runtime::context::set_scheduler<tuple$<alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core,alloc::alloc::Global>,enum2$<core::option::Option<enum2$<core::result::Result<tuple$<>,std::io::error::Error> > > > >,tokio::runtime::scheduler
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\context.rs:176
  37: tokio::runtime::scheduler::current_thread::CoreGuard::enter<tokio::runtime::scheduler::current_thread::impl$8::block_on::closure_env$0<core::pin::Pin<ref_mut$<enum2$<tokio::task::local::impl$4::run_until::async_fn_env$0<enum2$<drift_gateway::main::async_b
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\scheduler\current_thread\mod.rs:737
  38: tokio::runtime::scheduler::current_thread::CoreGuard::block_on<core::pin::Pin<ref_mut$<enum2$<tokio::task::local::impl$4::run_until::async_fn_env$0<enum2$<drift_gateway::main::async_block_env$0> > > > > >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\scheduler\current_thread\mod.rs:646
  39: tokio::runtime::scheduler::current_thread::impl$0::block_on::closure$0<enum2$<tokio::task::local::impl$4::run_until::async_fn_env$0<enum2$<drift_gateway::main::async_block_env$0> > > >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\scheduler\current_thread\mod.rs:175
  40: tokio::runtime::context::runtime::enter_runtime<tokio::runtime::scheduler::current_thread::impl$0::block_on::closure_env$0<enum2$<tokio::task::local::impl$4::run_until::async_fn_env$0<enum2$<drift_gateway::main::async_block_env$0> > > >,enum2$<core::resul
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\context\runtime.rs:65
  41: tokio::runtime::scheduler::current_thread::CurrentThread::block_on<enum2$<tokio::task::local::impl$4::run_until::async_fn_env$0<enum2$<drift_gateway::main::async_block_env$0> > > >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\scheduler\current_thread\mod.rs:167
  42: tokio::runtime::runtime::Runtime::block_on<enum2$<tokio::task::local::impl$4::run_until::async_fn_env$0<enum2$<drift_gateway::main::async_block_env$0> > > >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\runtime\runtime.rs:349
  43: tokio::task::local::LocalSet::block_on<enum2$<drift_gateway::main::async_block_env$0> >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.37.0\src\task\local.rs:592
  44: actix_rt::runtime::Runtime::block_on<enum2$<drift_gateway::main::async_block_env$0> >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\actix-rt-2.9.0\src\runtime.rs:138
  45: actix_rt::system::SystemRunner::block_on<enum2$<drift_gateway::main::async_block_env$0> >
             at C:\Users\paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\actix-rt-2.9.0\src\system.rs:245
  46: drift_gateway::main
             at C:\temp\gateway-master\src\main.rs:208
  47: core::ops::function::FnOnce::call_once<enum2$<core::result::Result<tuple$<>,std::io::error::Error> > (*)(),tuple$<> >
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\ops\function.rs:250
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.```
jordy25519 commented 6 months ago

1) please ensure to compile with rust stable <= v1.76.0 2) if on m1 mac then also do rustup target install x86_64-apple-darwin and use the x86 target

wildbunny commented 6 months ago

Thanks, that was the problem.

For anyone wondering how to install 1.76.0 after having installed the latest version (on windows):

rustup install 1.76.0
rustup default 1.76.0-x86_64-pc-windows-msvc