Skip to content

Commit

Permalink
Enable clippy in CI for dex-router-osmosis test-tube tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lubkoll committed Jul 27, 2024
1 parent ad436d1 commit 74494c2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
key: ${{ runner.os }}-cargo-${{ inputs.workspace }}-$GITHUB_SHA
restore-keys: ${{ runner.os }}-cargo-${{ inputs.workspace }}
- name: Rust lint
run: RUSTFLAGS="-Dwarnings" cargo clippy --workspace -- -D warnings --A deprecated
run: cargo clippy --workspace -- -D warnings --A deprecated
working-directory: smart-contracts/${{ inputs.workspace }}/${{ inputs.target }}
- name: Rust format check
run: cargo fmt --all -- --check
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test_tube_osmosis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ jobs:
smart-contracts/osmosis/**/target
key: ${{ runner.os }}-cargo-osmosis-$GITHUB_SHA
restore-keys: ${{ runner.os }}-cargo-osmosis
- name: Rust lint
run: cargo clippy --features test-tube --all-targets -- -D warnings --A deprecated
working-directory: smart-contracts/osmosis/contracts/dex-router-osmosis
- name: Build merkle-incentives
run: cargo test-tube-build
working-directory: smart-contracts/osmosis/contracts/merkle-incentives
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub fn single_cl_pool_fixture(

let pm = PoolManager::new(app);
let cl = ConcentratedLiquidity::new(app);
let gov = GovWithAppAccess::new(&app);
let gov = GovWithAppAccess::new(app);

gov.propose_and_execute(
CreateConcentratedLiquidityPoolsProposal::TYPE_URL.to_string(),
Expand All @@ -65,12 +65,12 @@ pub fn single_cl_pool_fixture(
pool_records: vec![PoolRecord {
denom0: cl_pool.denom0.clone(),
denom1: cl_pool.denom1.clone(),
tick_spacing: cl_pool.tick_spacing.clone(),
tick_spacing: cl_pool.tick_spacing,
spread_factor: cl_pool.spread_factor.clone(),
}],
},
admin.address(),
&admin,
admin,
)
.unwrap();

Expand Down Expand Up @@ -110,7 +110,7 @@ pub fn single_cl_pool_fixture(
token_min_amount0: "1".to_string(),
token_min_amount1: "1".to_string(),
},
&admin,
admin,
)
.unwrap();

Expand Down Expand Up @@ -199,18 +199,18 @@ pub fn single_gamm_pool_fixture(
.unwrap(),
},
],
&admin,
admin,
)
.unwrap();

let ty = "pool_created";
let keys = vec!["pool_id"];
let key = "pool_id";
let pool_id: u64 = response
.events
.iter()
.filter(|event| event.ty == ty)
.flat_map(|event| event.attributes.clone())
.filter(|attribute| keys.contains(&attribute.key.as_str()))
.filter(|attribute| key == attribute.key.as_str())
.collect::<Vec<Attribute>>()
.first()
.unwrap()
Expand All @@ -220,7 +220,7 @@ pub fn single_gamm_pool_fixture(

let _ = MsgJoinPool {
sender: admin.address().to_string(),
pool_id: pool_id.clone(),
pool_id,
share_out_amount: "100".to_string(),
token_in_maxs: vec![
Coin {
Expand Down Expand Up @@ -303,7 +303,7 @@ pub fn setup_paths(
admin: &SigningAccount,
) {
wasm.execute(
&contract_address.to_string(),
contract_address.as_ref(),
&ExecuteMsg::SetPath {
path,
bidirectional: true,
Expand Down Expand Up @@ -339,7 +339,7 @@ pub fn perform_swap(
admin: &SigningAccount,
) -> Result<ExecuteResponse<MsgExecuteContractResponse>, osmosis_test_tube::RunnerError> {
wasm.execute(
&contract_address.to_string(),
contract_address.as_ref(),
&ExecuteMsg::Swap {
out_denom: ask_denom,
path: Some(path.first().unwrap().clone()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn default_init_works() {

let resp: BestPathForPairResponse = wasm
.query(
&contract_address.to_string(),
contract_address.as_ref(),
&QueryMsg::BestPathForPair {
offer: Coin::new(
Uint128::from(100000000u128).into(),
Expand Down Expand Up @@ -152,7 +152,7 @@ fn test_set_and_remove_path() {
);
let _ = wasm
.execute(
&contract_address.to_string(),
contract_address.as_ref(),
&ExecuteMsg::RemovePath {
path: vec![pools.first().unwrap().pool],
bidirectional: true,
Expand Down

0 comments on commit 74494c2

Please sign in to comment.