Skip to content

Commit c56aa68

Browse files
committed
chore(target_chains/cosmwasm): fix Rust version in CI
1 parent 129d3ca commit c56aa68

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

.github/workflows/ci-cosmwasm-contract.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ jobs:
2323
working-directory: target_chains/cosmwasm/contracts/pyth
2424
steps:
2525
- uses: actions/checkout@v2
26+
- uses: actions-rs/toolchain@v1
27+
with:
28+
profile: minimal
29+
toolchain: 1.82.0
30+
components: rustfmt, clippy
31+
override: true
2632
- name: Build
2733
run: cargo build --verbose
2834
- name: Run tests

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ repos:
4343
- id: cargo-clippy-cosmwasm
4444
name: Cargo clippy for cosmwasm contract
4545
language: "rust"
46-
entry: cargo +nightly-2023-03-01 clippy --manifest-path ./target_chains/cosmwasm/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
46+
entry: cargo +1.82.0 clippy --manifest-path ./target_chains/cosmwasm/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
4747
pass_filenames: false
4848
files: target_chains/cosmwasm
4949
# Hooks for Hermes

target_chains/cosmwasm/contracts/pyth/src/contract.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ fn update_price_feeds(
261261
data: &[Binary],
262262
) -> StdResult<Response<MsgWrapper>> {
263263
if !is_fee_sufficient(&deps.as_ref(), info, data)? {
264-
return Err(PythContractError::InsufficientFee)?;
264+
Err(PythContractError::InsufficientFee)?;
265265
}
266266

267267
let (num_total_attestations, total_new_feeds) = apply_updates(&mut deps, &env, data)?;
@@ -308,7 +308,7 @@ fn execute_governance_instruction(
308308
// Governance messages must be applied in order. This check prevents replay attacks where
309309
// previous messages are re-applied.
310310
if vaa.sequence <= state.governance_sequence_number {
311-
return Err(PythContractError::OldGovernanceMessage)?;
311+
Err(PythContractError::OldGovernanceMessage)?;
312312
} else {
313313
updated_config.governance_sequence_number = vaa.sequence;
314314
}
@@ -320,13 +320,13 @@ fn execute_governance_instruction(
320320
// Check that the instruction is intended for this chain.
321321
// chain_id = 0 means the instruction applies to all chains
322322
if instruction.target_chain_id != state.chain_id && instruction.target_chain_id != 0 {
323-
return Err(PythContractError::InvalidGovernancePayload)?;
323+
Err(PythContractError::InvalidGovernancePayload)?;
324324
}
325325

326326
// Check that the instruction is intended for this target chain contract (as opposed to
327327
// other Pyth contracts that may live on the same chain).
328328
if instruction.module != GovernanceModule::Target {
329-
return Err(PythContractError::InvalidGovernancePayload)?;
329+
Err(PythContractError::InvalidGovernancePayload)?;
330330
}
331331

332332
let response = match instruction.action {
@@ -463,7 +463,7 @@ fn verify_vaa_from_data_source(state: &ConfigInfo, vaa: &ParsedVAA) -> StdResult
463463
chain_id: vaa.emitter_chain,
464464
};
465465
if !state.data_sources.contains(&vaa_data_source) {
466-
return Err(PythContractError::InvalidUpdateEmitter)?;
466+
Err(PythContractError::InvalidUpdateEmitter)?;
467467
}
468468
Ok(())
469469
}
@@ -475,7 +475,7 @@ fn verify_vaa_from_governance_source(state: &ConfigInfo, vaa: &ParsedVAA) -> Std
475475
chain_id: vaa.emitter_chain,
476476
};
477477
if state.governance_source != vaa_data_source {
478-
return Err(PythContractError::InvalidUpdateEmitter)?;
478+
Err(PythContractError::InvalidUpdateEmitter)?;
479479
}
480480
Ok(())
481481
}
@@ -533,7 +533,7 @@ fn parse_accumulator(deps: &Deps, env: &Env, data: &[u8]) -> StdResult<Vec<Price
533533
for update in updates {
534534
let message_vec = Vec::from(update.message);
535535
if !root.check(update.proof, &message_vec) {
536-
return Err(PythContractError::InvalidMerkleProof)?;
536+
Err(PythContractError::InvalidMerkleProof)?;
537537
}
538538

539539
let msg = from_slice::<BigEndian, Message>(&message_vec)
@@ -683,7 +683,7 @@ pub fn parse_price_feed_updates(
683683
) -> StdResult<Response<MsgWrapper>> {
684684
let _config = config_read(deps.storage).load()?;
685685
if !is_fee_sufficient(&deps.as_ref(), info, updates)? {
686-
return Err(PythContractError::InsufficientFee)?;
686+
Err(PythContractError::InsufficientFee)?;
687687
}
688688
let mut found_feeds = 0;
689689
let mut results: Vec<(Identifier, Option<PriceFeed>)> =
@@ -709,7 +709,7 @@ pub fn parse_price_feed_updates(
709709
}
710710
}
711711
if found_feeds != price_feeds.len() {
712-
return Err(PythContractError::InvalidUpdatePayload)?;
712+
Err(PythContractError::InvalidUpdatePayload)?;
713713
}
714714

715715
let _unwrapped_feeds = results
@@ -1894,7 +1894,7 @@ mod test {
18941894
})
18951895
.unwrap();
18961896

1897-
let updates = vec![Binary::from([1u8]), Binary::from([2u8])];
1897+
let updates = [Binary::from([1u8]), Binary::from([2u8])];
18981898

18991899
assert_eq!(
19001900
get_update_fee(&deps.as_ref(), &updates[0..0]),

0 commit comments

Comments
 (0)