Compare commits

...

2 Commits

Author SHA1 Message Date
Riordan Panayides c2a942336c Set up fly deployments, upgrade mango-v4 2023-01-04 00:04:35 +00:00
Riordan Panayides 1b1063c5a7 Restore CI scripts 2023-01-04 00:03:16 +00:00
19 changed files with 374 additions and 59 deletions

39
Cargo.lock generated
View File

@ -104,7 +104,7 @@ checksum = "6b2d54853319fd101b8dd81de382bcbf3e03410a64d8928bbee85a3e7dcde483"
[[package]]
name = "anchor-attribute-access-control"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-syn",
"anyhow",
@ -117,7 +117,7 @@ dependencies = [
[[package]]
name = "anchor-attribute-account"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-syn",
"anyhow",
@ -131,7 +131,7 @@ dependencies = [
[[package]]
name = "anchor-attribute-constant"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-syn",
"proc-macro2 1.0.47",
@ -141,7 +141,7 @@ dependencies = [
[[package]]
name = "anchor-attribute-error"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-syn",
"proc-macro2 1.0.47",
@ -152,7 +152,7 @@ dependencies = [
[[package]]
name = "anchor-attribute-event"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-syn",
"anyhow",
@ -164,7 +164,7 @@ dependencies = [
[[package]]
name = "anchor-attribute-interface"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-syn",
"anyhow",
@ -177,7 +177,7 @@ dependencies = [
[[package]]
name = "anchor-attribute-program"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-syn",
"anyhow",
@ -189,7 +189,7 @@ dependencies = [
[[package]]
name = "anchor-attribute-state"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-syn",
"anyhow",
@ -201,7 +201,7 @@ dependencies = [
[[package]]
name = "anchor-client"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-lang",
"anyhow",
@ -217,7 +217,7 @@ dependencies = [
[[package]]
name = "anchor-derive-accounts"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-syn",
"anyhow",
@ -229,7 +229,7 @@ dependencies = [
[[package]]
name = "anchor-lang"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-attribute-access-control",
"anchor-attribute-account",
@ -252,7 +252,7 @@ dependencies = [
[[package]]
name = "anchor-spl"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-lang",
"solana-program",
@ -263,7 +263,7 @@ dependencies = [
[[package]]
name = "anchor-syn"
version = "0.25.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anyhow",
"bs58 0.3.1",
@ -411,6 +411,12 @@ dependencies = [
"event-listener",
]
[[package]]
name = "async-once-cell"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f61305cacf1d0c5c9d3ee283d22f8f1f8c743a18ceb44a1b102bd53476c141de"
[[package]]
name = "async-stream"
version = "0.2.1"
@ -966,7 +972,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "checked_math"
version = "0.1.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"proc-macro-error",
"proc-macro2 1.0.47",
@ -1072,12 +1078,13 @@ dependencies = [
[[package]]
name = "client"
version = "0.1.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-client",
"anchor-lang",
"anchor-spl",
"anyhow",
"async-once-cell",
"async-trait",
"base64 0.13.1",
"bincode",
@ -3005,7 +3012,7 @@ dependencies = [
[[package]]
name = "mango-v4"
version = "0.1.0"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=dev#7a8f31c6118b0577aa6375af4643e41efe85e057"
source = "git+https://github.com/blockworks-foundation/mango-v4?branch=ckamm/accountfetcher-send#0bad232315b6c5ddf420d728dfcb13c18a0fb50f"
dependencies = [
"anchor-lang",
"anchor-spl",

View File

@ -11,7 +11,7 @@ members = [
# for gzip encoded responses
jsonrpc-core-client = { git = "https://github.com/ckamm/jsonrpc.git", branch = "ckamm/http-with-gzip" }
# force usage of mango-v4 submodules with 1.14.9 support
anchor-spl = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "dev" }
anchor-lang = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "dev" }
anchor-client = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "dev" }
anchor-spl = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "ckamm/accountfetcher-send" }
anchor-lang = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "ckamm/accountfetcher-send" }
anchor-client = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "ckamm/accountfetcher-send" }
switchboard-v2 = { git = "https://github.com/blockworks-foundation/sbv2-solana", branch = "mango-v4" }

View File

@ -1,24 +1,25 @@
# syntax = docker/dockerfile:1.2
# Base image containing all binaries, deployed to gcr.io/mango-markets/mango-geyser-services:latest
FROM rust:1.59.0 as base
RUN cargo install cargo-chef
FROM rust:1.65.0 as base
# RUN cargo install cargo-chef
RUN rustup component add rustfmt
RUN apt-get update && apt-get install -y clang cmake
RUN apt-get update && apt-get install -y clang cmake ssh
WORKDIR /app
FROM base AS plan
COPY . .
WORKDIR /app
RUN cargo chef prepare --recipe-path recipe.json
# RUN cargo chef prepare --recipe-path recipe.json
FROM base as build
COPY --from=plan /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
# COPY --from=plan /app/recipe.json recipe.json
# RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release --bin service-mango-fills --bin service-mango-pnl
RUN cargo build --release --bin service-mango-fills --bin service-mango-pnl --bin service-mango-orderbook
FROM debian:bullseye-slim as run
RUN apt-get update && apt-get -y install ca-certificates libc6
COPY --from=build /app/target/release/service-mango-* /usr/local/bin/
COPY --from=build /app/service-mango-pnl/template-config.toml ./pnl-config.toml
COPY --from=build /app/service-mango-fills/template-config.toml ./fills-config.toml
COPY --from=build /app/service-mango-fills/template-config.toml ./fills-config.toml
COPY --from=build /app/service-mango-orderbook/template-config.toml ./orderbook-config.toml

20
ci/cargo-build-test.sh Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Source:
# https://github.com/solana-labs/solana-accountsdb-plugin-postgres/blob/master/ci/cargo-build-test.sh
set -e
cd "$(dirname "$0")/.."
source ./ci/rust-version.sh stable
export RUSTFLAGS="-D warnings"
export RUSTBACKTRACE=1
set -x
# Build/test all host crates
cargo +"$rust_stable" build
cargo +"$rust_stable" test -- --nocapture
exit 0

78
ci/cargo-install-all.sh Executable file
View File

@ -0,0 +1,78 @@
#!/usr/bin/env bash
set -e
usage() {
exitcode=0
if [[ -n "$1" ]]; then
exitcode=1
echo "Error: $*"
fi
cat <<EOF
usage: $0 [+<cargo version>] [--debug] <install directory>
EOF
exit $exitcode
}
case "$CI_OS_NAME" in
osx)
libExt=dylib
;;
linux)
libExt=so
;;
*)
echo CI_OS_NAME unsupported
exit 1
;;
esac
maybeRustVersion=
installDir=
buildVariant=release
maybeReleaseFlag=--release
while [[ -n $1 ]]; do
if [[ ${1:0:1} = - ]]; then
if [[ $1 = --debug ]]; then
maybeReleaseFlag=
buildVariant=debug
shift
else
usage "Unknown option: $1"
fi
elif [[ ${1:0:1} = \+ ]]; then
maybeRustVersion=$1
shift
else
installDir=$1
shift
fi
done
if [[ -z "$installDir" ]]; then
usage "Install directory not specified"
exit 1
fi
installDir="$(mkdir -p "$installDir"; cd "$installDir"; pwd)"
echo "Install location: $installDir ($buildVariant)"
cd "$(dirname "$0")"/..
SECONDS=0
mkdir -p "$installDir/lib"
(
set -x
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
cargo $maybeRustVersion build $maybeReleaseFlag --lib
)
cp -fv "target/$buildVariant/${GEYSER_PLUGIN_LIB}.$libExt" "$installDir"/lib/
echo "Done after $SECONDS seconds"

51
ci/create-tarball.sh Executable file
View File

@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")/.."
case "$CI_OS_NAME" in
osx)
_cputype="$(uname -m)"
if [[ $_cputype = arm64 ]]; then
_cputype=aarch64
fi
TARGET=${_cputype}-apple-darwin
;;
linux)
TARGET=x86_64-unknown-linux-gnu
;;
*)
echo CI_OS_NAME unsupported
exit 1
;;
esac
RELEASE_BASENAME="${RELEASE_BASENAME:="${GEYSER_PLUGIN_NAME}-release"}"
TARBALL_BASENAME="${TARBALL_BASENAME:="$RELEASE_BASENAME"}"
echo --- Creating release tarball
(
set -x
rm -rf "${RELEASE_BASENAME:?}"/
mkdir "${RELEASE_BASENAME}"/
COMMIT="$(git rev-parse HEAD)"
(
echo "channel: $CI_TAG"
echo "commit: $COMMIT"
echo "target: $TARGET"
) > "${RELEASE_BASENAME}"/version.yml
# Make CHANNEL available to include in the software version information
export CHANNEL
source ci/rust-version.sh stable
ci/cargo-install-all.sh stable "${RELEASE_BASENAME}"
tar cvf "${TARBALL_BASENAME}"-$TARGET.tar "${RELEASE_BASENAME}"
bzip2 "${TARBALL_BASENAME}"-$TARGET.tar
cp "${RELEASE_BASENAME}"/version.yml "${TARBALL_BASENAME}"-$TARGET.yml
)
echo --- ok

3
ci/env.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
plugin_name=solana-geyser-sqs-grpc-release
plugin_lib_name=solana_geyser_connector_plugin_grpc

137
ci/rust-version.sh Executable file
View File

@ -0,0 +1,137 @@
#!/usr/bin/env bash
# Source:
# https://github.com/solana-labs/solana-accountsdb-plugin-postgres/blob/master/ci/rust-version.sh
#
# This file maintains the rust versions for use by CI.
#
# Obtain the environment variables without any automatic toolchain updating:
# $ source ci/rust-version.sh
#
# Obtain the environment variables updating both stable and nightly, only stable, or
# only nightly:
# $ source ci/rust-version.sh all
# $ source ci/rust-version.sh stable
# $ source ci/rust-version.sh nightly
# Then to build with either stable or nightly:
# $ cargo +"$rust_stable" build
# $ cargo +"$rust_nightly" build
#
if [[ -n $RUST_STABLE_VERSION ]]; then
stable_version="$RUST_STABLE_VERSION"
else
stable_version=1.59.0
fi
if [[ -n $RUST_NIGHTLY_VERSION ]]; then
nightly_version="$RUST_NIGHTLY_VERSION"
else
nightly_version=2022-02-24
fi
export rust_stable="$stable_version"
export rust_stable_docker_image=solanalabs/rust:"$stable_version"
export rust_nightly=nightly-"$nightly_version"
export rust_nightly_docker_image=solanalabs/rust-nightly:"$nightly_version"
[[ -z $1 ]] || (
rustup_install() {
declare toolchain=$1
if ! cargo +"$toolchain" -V > /dev/null; then
echo "$0: Missing toolchain? Installing...: $toolchain" >&2
rustup install "$toolchain"
cargo +"$toolchain" -V
fi
}
set -e
cd "$(dirname "${BASH_SOURCE[0]}")"
case $1 in
stable)
rustup_install "$rust_stable"
;;
nightly)
rustup_install "$rust_nightly"
;;
all)
rustup_install "$rust_stable"
rustup_install "$rust_nightly"
;;
*)
echo "$0: Note: ignoring unknown argument: $1" >&2
;;
esac
)#!/usr/bin/env bash
# Source:
# https://github.com/solana-labs/solana-accountsdb-plugin-postgres/blob/master/ci/rust-version.sh
#
# This file maintains the rust versions for use by CI.
#
# Obtain the environment variables without any automatic toolchain updating:
# $ source ci/rust-version.sh
#
# Obtain the environment variables updating both stable and nightly, only stable, or
# only nightly:
# $ source ci/rust-version.sh all
# $ source ci/rust-version.sh stable
# $ source ci/rust-version.sh nightly
# Then to build with either stable or nightly:
# $ cargo +"$rust_stable" build
# $ cargo +"$rust_nightly" build
#
if [[ -n $RUST_STABLE_VERSION ]]; then
stable_version="$RUST_STABLE_VERSION"
else
stable_version=1.59.0
fi
if [[ -n $RUST_NIGHTLY_VERSION ]]; then
nightly_version="$RUST_NIGHTLY_VERSION"
else
nightly_version=2022-02-24
fi
export rust_stable="$stable_version"
export rust_stable_docker_image=solanalabs/rust:"$stable_version"
export rust_nightly=nightly-"$nightly_version"
export rust_nightly_docker_image=solanalabs/rust-nightly:"$nightly_version"
[[ -z $1 ]] || (
rustup_install() {
declare toolchain=$1
if ! cargo +"$toolchain" -V > /dev/null; then
echo "$0: Missing toolchain? Installing...: $toolchain" >&2
rustup install "$toolchain"
cargo +"$toolchain" -V
fi
}
set -e
cd "$(dirname "${BASH_SOURCE[0]}")"
case $1 in
stable)
rustup_install "$rust_stable"
;;
nightly)
rustup_install "$rust_nightly"
;;
all)
rustup_install "$rust_stable"
rustup_install "$rust_nightly"
;;
*)
echo "$0: Note: ignoring unknown argument: $1" >&2
;;
esac
)

9
ci/solana-version.sh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Prints the Solana version.
set -e
cd "$(dirname "$0")/.."
cargo read-manifest | jq -r '.dependencies[] | select(.name == "solana-geyser-plugin-interface") | .req'

View File

@ -3,12 +3,13 @@ app = "mango-geyser-services"
kill_signal = "SIGINT"
kill_timeout = 5
[build]
image = "us-docker.pkg.dev/mango-markets/gcr.io/mango-geyser-services:latest"
# [build]
# image = "us-docker.pkg.dev/mango-markets/gcr.io/mango-geyser-services:latest"
[processes]
fills = "service-mango-fills fills-config.toml"
pnl = "service-mango-pnl pnl-config.toml"
orderbook = "service-mango-orderbook orderbook-config.toml"
[[services]]
processes = ["fills"]
@ -16,6 +17,7 @@ kill_timeout = 5
protocol = "tcp"
[[services.ports]]
handlers = ["tls", "http"]
port = "8080"
[services.concurrency]
@ -25,11 +27,26 @@ kill_timeout = 5
[[services]]
processes = ["pnl"]
internal_port = 2052
internal_port = 8081
protocol = "tcp"
[[services.ports]]
port = "2052"
handlers = ["tls", "http"]
port = 8081
[services.concurrency]
type = "connections"
hard_limit = 1024
soft_limit = 1024
[[services]]
processes = ["orderbook"]
internal_port = 8082
protocol = "tcp"
[[services.ports]]
handlers = ["tls", "http"]
port = "8082"
[services.concurrency]
type = "connections"

View File

@ -16,7 +16,7 @@ solana-client = "~1.14.9"
solana-account-decoder = "~1.14.9"
solana-sdk = "~1.14.9"
mango-v4 = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "dev" }
mango-v4 = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "ckamm/accountfetcher-send" }
arrayref = "*"
bytemuck = "*"
fixed = { version = "*", features = ["serde"] }

View File

@ -326,7 +326,7 @@ fn publish_changes_serum(
let mkt_pk_string = mkt.0.to_string();
let evq_pk_string = mkt.1.to_string();
let header_seq_num = header.seq_num;
info!("start seq {} header seq {}", start_seq_num, header_seq_num);
debug!("start seq {} header seq {}", start_seq_num, header_seq_num);
for seq_num in start_seq_num..header_seq_num {
let idx = (seq_num % MAX_NUM_EVENTS as u64) as usize;
let event_view = events[idx].as_view().unwrap();
@ -340,7 +340,7 @@ fn publish_changes_serum(
// 3) all other events are matching the old event queue
// the order of these checks is important so they are exhaustive
if seq_num >= old_seq_num {
info!("found new serum fill {} idx {}", mkt_pk_string, idx,);
debug!("found new serum fill {} idx {}", mkt_pk_string, idx,);
metric_events_new.increment();
fill_update_sender
@ -359,12 +359,11 @@ fn publish_changes_serum(
match old_event_view {
EventView::Fill { .. } => {
info!("already got all fills???");
// every already published event is recorded in checkpoint
checkpoint.push(events[idx]);
}
EventView::Out { .. } => {
info!(
debug!(
"found changed event {} idx {} seq_num {} header seq num {} old seq num {}",
mkt_pk_string, idx, seq_num, header_seq_num, old_seq_num
);

View File

@ -147,7 +147,6 @@ fn publish_changes(
match peer {
None => {
info!("level removed {}", previous_order.price);
update.push(OrderbookLevel {
price: previous_order.price,
size: 0f64,
@ -203,7 +202,7 @@ fn publish_changes(
if update.len() == 0 {
return;
}
info!("diff {} {:?}", mkt.1.name, update);
orderbook_update_sender
.try_send(OrderbookFilterMessage::Update(OrderbookUpdate {
market: mkt.0.to_string(),
@ -237,7 +236,6 @@ fn publish_changes_serum(
match peer {
None => {
info!("level removed {}", previous_order.price);
update.push(OrderbookLevel {
price: previous_order.price,
size: 0f64,
@ -290,7 +288,6 @@ fn publish_changes_serum(
None => info!("other bookside not in cache"),
}
info!("diff {} {:?}", mkt.1.name, update);
if update.len() > 0 {
orderbook_update_sender
.try_send(OrderbookFilterMessage::Update(OrderbookUpdate {
@ -352,7 +349,6 @@ pub async fn init(
if !relevant_pubkeys.contains(&account_write.pubkey) {
continue;
}
info!("updating account {}", &account_write.pubkey);
chain_cache.update_account(
account_write.pubkey,
AccountData {
@ -470,7 +466,6 @@ pub async fn init(
let account = &mut account_info.account.clone();
let data = account.data_as_mut_slice();
let len = data.len();
info!("side pk {} side {}", side_pk, side);
let inner = &mut data[5..len - 7];
let slab = Slab::new(&mut inner[size_of::<OrderBookStateHeader>()..]);

View File

@ -24,8 +24,8 @@ tokio = { version = "1", features = ["full"] }
tokio-tungstenite = "0.17"
bytemuck = "1.7.2"
mango-v4 = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "dev" }
client = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "dev" }
mango-v4 = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "ckamm/accountfetcher-send" }
client = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "ckamm/accountfetcher-send" }
serum_dex = { git = "https://github.com/jup-ag/openbook-program", branch = "feat/expose-things" }
anchor-lang = "0.25.0"
anchor-client = "0.25.0"

View File

@ -275,10 +275,9 @@ async fn main() -> anyhow::Result<()> {
Some(rpc_timeout),
);
let group_context = Arc::new(MangoGroupContext::new_from_rpc(
&client.rpc_async(),
Pubkey::from_str(&config.mango_group).unwrap(),
client.cluster.clone(),
client.commitment,
)?);
).await?);
let perp_queue_pks: Vec<(Pubkey, Pubkey)> = group_context
.perp_markets
@ -293,8 +292,8 @@ async fn main() -> anyhow::Result<()> {
.collect();
let serum_market_ais = client
.rpc()
.get_multiple_accounts(serum_market_pks.as_slice())?;
.rpc_async()
.get_multiple_accounts(serum_market_pks.as_slice()).await?;
let serum_market_ais: Vec<&Account> = serum_market_ais
.iter()
.filter_map(|maybe_ai| match maybe_ai {
@ -317,11 +316,11 @@ async fn main() -> anyhow::Result<()> {
let a: Vec<(String, String)> = group_context
.serum3_markets
.iter()
.map(|(_, context)| (context.market.name().to_owned(), context.market.serum_market_external.to_string())).collect();
.map(|(_, context)| (context.market.serum_market_external.to_string(), context.market.name().to_owned())).collect();
let b: Vec<(String, String)> = group_context
.perp_markets
.iter()
.map(|(_, context)| (context.market.name().to_owned(), context.address.to_string())).collect();
.map(|(_, context)| (context.address.to_string(), context.market.name().to_owned())).collect();
let market_pubkey_strings: HashMap<String, String> = [a, b]
.concat()
.into_iter()

View File

@ -24,8 +24,8 @@ tokio = { version = "1", features = ["full"] }
tokio-tungstenite = "0.17"
bytemuck = "1.7.2"
mango-v4 = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "dev" }
client = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "dev" }
mango-v4 = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "ckamm/accountfetcher-send" }
client = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "ckamm/accountfetcher-send" }
serum_dex = { git = "https://github.com/openbook-dex/program", branch = "master" }
anchor-lang = "0.25.0"
anchor-client = "0.25.0"

View File

@ -286,10 +286,9 @@ async fn main() -> anyhow::Result<()> {
Some(rpc_timeout),
);
let group_context = Arc::new(MangoGroupContext::new_from_rpc(
&client.rpc_async(),
Pubkey::from_str(&config.mango_group).unwrap(),
client.cluster.clone(),
client.commitment,
)?);
).await?);
// todo: reload markets at intervals
let market_configs: Vec<(Pubkey, MarketConfig)> = group_context

View File

@ -21,7 +21,7 @@ tokio = { version = "1", features = ["full"] }
serde = "1.0.130"
serde_derive = "1.0.130"
mango-v4 = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "dev" }
client = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "dev" }
mango-v4 = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "ckamm/accountfetcher-send" }
client = { git = "https://github.com/blockworks-foundation/mango-v4", branch = "ckamm/accountfetcher-send" }
anchor-lang = "0.25.0"
anchor-client = "0.25.0"

View File

@ -119,7 +119,7 @@ fn start_pnl_updater(
}
let pnl_vals =
compute_pnl(context.clone(), account_fetcher.clone(), &mango_account.clone()).await.unwrap();
compute_pnl(context.clone(), account_fetcher.clone(), &mango_account).await.unwrap();
// Alternatively, we could prepare the sorted and limited lists for each
// market here. That would be faster and cause less contention on the pnl_data