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

Rust unify #2079

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-fortuna.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-07-23
toolchain: 1.82.0
override: true
- name: Run executor tests
run: cargo test --manifest-path ./apps/fortuna/Cargo.toml
2 changes: 1 addition & 1 deletion .github/workflows/ci-hermes-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2024-03-26
toolchain: 1.82.0
components: rustfmt, clippy
override: true
- name: Install protoc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-message-buffer-idl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-03-01
toolchain: 1.82.0
components: rustfmt, clippy
- name: Install Solana
run: |
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/ci-near-contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@ jobs:
- uses: actions/checkout@v2
- name: Install nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- name: Install Near Sandbox
run: |
mkdir /tmp/near-sandbox
curl -LsSf https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/Linux-x86_64/2.1.1/near-sandbox.tar.gz | tar zxf - -C /tmp/near-sandbox
- name: Test
run: ./workspace-test.sh
run: NEAR_SANDBOX_BIN_PATH=/tmp/near-sandbox/Linux-x86_64/near-sandbox ./workspace-test.sh
17 changes: 1 addition & 16 deletions .github/workflows/ci-pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-03-01
components: rustfmt, clippy
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-07-23
components: rustfmt, clippy
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2024-03-26
components: rustfmt, clippy
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2024-08-04
toolchain: 1.82.0
components: rustfmt, clippy
- name: Install protoc
uses: arduino/setup-protoc@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-remote-executor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.66.1
toolchain: 1.82.0
components: rustfmt, clippy
override: true
- name: Install Solana
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-starknet-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.78.0
toolchain: 1.82.0
components: rustfmt, clippy
override: true
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pyth-price-store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: 1.82.0
default: true
profile: minimal
- name: Publish
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-pyth-solana-receiver-state.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: 1.82.0
default: true
profile: minimal

- run: cargo +stable-x86_64-unknown-linux-gnu publish --token ${CARGO_REGISTRY_TOKEN}
- run: cargo publish --token ${CARGO_REGISTRY_TOKEN}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
working-directory: "target_chains/solana/pyth_solana_receiver_sdk"
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repos:
- id: cargo-clippy-remote-executor
name: Cargo clippy for remote executor
language: "rust"
entry: cargo +nightly-2023-03-01 clippy --manifest-path ./governance/remote_executor/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
entry: cargo clippy --manifest-path ./governance/remote_executor/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
pass_filenames: false
files: governance/remote_executor
# Hooks for cosmwasm contract
Expand All @@ -43,7 +43,7 @@ repos:
- id: cargo-clippy-cosmwasm
name: Cargo clippy for cosmwasm contract
language: "rust"
entry: cargo +nightly-2023-03-01 clippy --manifest-path ./target_chains/cosmwasm/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
entry: cargo clippy --manifest-path ./target_chains/cosmwasm/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
pass_filenames: false
files: target_chains/cosmwasm
# Hooks for Hermes
Expand All @@ -56,7 +56,7 @@ repos:
- id: cargo-clippy-hermes
name: Cargo clippy for Hermes
language: "rust"
entry: cargo +nightly-2024-03-26 clippy --manifest-path ./apps/hermes/server/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
entry: cargo clippy --manifest-path ./apps/hermes/server/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
pass_filenames: false
files: apps/hermes
# Hooks for Fortuna
Expand All @@ -76,7 +76,7 @@ repos:
- id: cargo-clippy-message-buffer
name: Cargo clippy for message buffer contract
language: "rust"
entry: cargo +nightly-2023-03-01 clippy --manifest-path ./pythnet/message_buffer/Cargo.toml --tests --fix --allow-dirty --allow-staged --features test-bpf -- -D warnings
entry: cargo clippy --manifest-path ./pythnet/message_buffer/Cargo.toml --tests --fix --allow-dirty --allow-staged --features test-bpf -- -D warnings
pass_filenames: false
files: pythnet/message_buffer
# Hooks for pythnet_sdk
Expand All @@ -89,7 +89,7 @@ repos:
- id: cargo-clippy-pythnet-sdk
name: Cargo clippy for pythnet SDK
language: "rust"
entry: cargo +nightly-2024-08-04 clippy --manifest-path ./pythnet/pythnet_sdk/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
entry: cargo clippy --manifest-path ./pythnet/pythnet_sdk/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
pass_filenames: false
files: pythnet/pythnet_sdk
# Hooks for solana receiver contract
Expand All @@ -102,7 +102,7 @@ repos:
- id: cargo-clippy-pyth-solana-receiver
name: Cargo clippy for solana target chain contract
language: "rust"
entry: cargo +nightly-2023-03-01 clippy --manifest-path ./target_chains/solana/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
entry: cargo clippy --manifest-path ./target_chains/solana/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
pass_filenames: false
files: target_chains/solana
# For express relay python files
Expand Down
28 changes: 22 additions & 6 deletions apps/fortuna/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion apps/fortuna/rust-toolchain

This file was deleted.

7 changes: 1 addition & 6 deletions apps/fortuna/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#![allow(clippy::just_underscores_and_digits)]
#![feature(slice_flatten)]

use {
anyhow::Result,
clap::Parser,
std::io::IsTerminal,
};
use {anyhow::Result, clap::Parser, std::io::IsTerminal};

pub mod api;
pub mod chain;
Expand Down
8 changes: 4 additions & 4 deletions apps/hermes/server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions apps/hermes/server/rust-toolchain

This file was deleted.

3 changes: 0 additions & 3 deletions apps/hermes/server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![feature(never_type)]
#![feature(btree_cursors)]

use {
anyhow::Result,
clap::{
Expand Down
2 changes: 1 addition & 1 deletion apps/hermes/server/src/network/pythnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async fn fetch_bridge_data(
}
}

pub async fn run<S>(store: Arc<S>, pythnet_ws_endpoint: String) -> Result<!>
pub async fn run<S>(store: Arc<S>, pythnet_ws_endpoint: String) -> Result<()>
where
S: Aggregates,
S: Wormhole,
Expand Down
2 changes: 1 addition & 1 deletion apps/hermes/server/src/network/wormhole.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ where
}

#[tracing::instrument(skip(opts, state))]
async fn run<S>(opts: RunOptions, state: Arc<S>) -> Result<!>
async fn run<S>(opts: RunOptions, state: Arc<S>) -> Result<()>
where
S: Wormhole,
S: Send + Sync + 'static,
Expand Down
6 changes: 2 additions & 4 deletions apps/hermes/server/src/state/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use {
HashMap,
HashSet,
},
ops::Bound,
sync::Arc,
},
strum::IntoEnumIterator,
Expand Down Expand Up @@ -300,8 +299,8 @@ async fn retrieve_message_state(

// Get the first element that is greater than or equal to the lookup time.
key_cache
.lower_bound(Bound::Included(&lookup_time))
.peek_next()
.range(lookup_time..)
.next()
.map(|(_, v)| v)
.cloned()
}
Expand Down Expand Up @@ -594,7 +593,6 @@ mod test {
);
}


#[tokio::test]
pub async fn test_store_and_retrieve_first_after_message_state_fails_for_past_time() {
// Initialize state with a cache size of 2 per key.
Expand Down
1 change: 1 addition & 0 deletions governance/remote_executor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"programs/*",
"cli/"
Expand Down
2 changes: 1 addition & 1 deletion governance/remote_executor/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "remote-executor-cli"
version = "0.1.0"
edition = "2018"
edition = "2021"

[dependencies]
clap = {version ="3.2.22", features = ["derive"]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,9 @@ impl From<ExecutorError> for TransactionError {
fn from(val: ExecutorError) -> Self {
TransactionError::InstructionError(
0,
InstructionError::try_from(u64::from(ProgramError::from(
InstructionError::from(u64::from(ProgramError::from(
anchor_lang::prelude::Error::from(val),
)))
.unwrap(),
))),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,9 @@ impl IntoTransactionError for ErrorCode {
fn into_transation_error(self) -> TransactionError {
TransactionError::InstructionError(
0,
InstructionError::try_from(u64::from(ProgramError::from(
InstructionError::from(u64::from(ProgramError::from(
anchor_lang::prelude::Error::from(self),
)))
.unwrap(),
))),
)
}
}
Expand Down
2 changes: 0 additions & 2 deletions governance/remote_executor/rust-toolchain.toml

This file was deleted.

Loading
Loading