Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/kb/serial-policy-for-SCs' into b…
Browse files Browse the repository at this point in the history
…ump-versions
  • Loading branch information
abizjak committed May 5, 2023
2 parents b1576d7 + e8b96f5 commit be31e22
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 20 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:

name: Clippy & fmt

env:
RUST_FMT: nightly-2023-04-01
RUST_VERSION: "1.60"


jobs:
rustfmt:
name: Format
Expand Down Expand Up @@ -51,7 +56,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-06-09
toolchain: ${{ env.RUST_FMT }}
override: true
components: rustfmt

Expand Down Expand Up @@ -137,7 +142,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.56
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true
components: clippy
Expand Down Expand Up @@ -223,7 +228,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.56
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true
components: clippy
Expand Down Expand Up @@ -263,7 +268,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.56
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true
components: clippy
Expand Down Expand Up @@ -300,7 +305,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.56
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true
components: clippy
Expand Down Expand Up @@ -340,7 +345,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.56
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true
components: clippy
Expand Down Expand Up @@ -452,7 +457,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.56
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true

Expand Down Expand Up @@ -503,7 +508,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.56
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true
components: clippy
Expand Down Expand Up @@ -540,7 +545,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.56
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true

Expand Down Expand Up @@ -576,7 +581,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.56
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true

Expand Down Expand Up @@ -629,7 +634,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.56
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ Changes to any of the packages must be such that
- ```cargo clippy --all``` produces no warnings
- ```rustfmt``` makes no changes.

Everything in this repository should build with rust version 1.53 (it should work with 1.51 and up, but we do not test regularly) however the `fmt` tool must be from a nightly release since some of the configuration options are not stable. One way to run the `fmt` tool is
Everything in this repository should build with rust version 1.60 however the `fmt` tool must be from a nightly release since some of the configuration options are not stable. One way to run the `fmt` tool is
```
cargo +nightly-2022-06-09 fmt
cargo +nightly-2023-04-01 fmt
```

(the exact version used by the CI can be found in [.github/workflows/linter.yml](.github/workflows/linter.yml) file).
You will need to have a recent enough nightly version installed, which can be done via

```
rustup toolchain install nightly-2022-06-09
rustup toolchain install nightly-2023-04-01
```

or similar, using the [rustup](https://rustup.rs/) tool. See the documentation of the tool for more details.
Expand Down
1 change: 1 addition & 0 deletions concordium-std/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Remove the use of `alloc_error_handler` since the feature is no longer
available in recent nightly builds of the compiler. This can increase the
smart contract size slightly.
- Set minimum Rust version to 1.60.

## concordium-std 6.1.1 (2023-03-16)

Expand Down
1 change: 1 addition & 0 deletions concordium-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "concordium-std"
version = "6.2.0"
authors = ["Concordium <developers@concordium.com>"]
edition = "2021"
rust-version = "1.60"
license = "MPL-2.0"
description = "A standard library for writing smart contracts for the Concordium blockchain in Rust."
homepage = "https://github.com/Concordium/concordium-rust-smart-contracts/"
Expand Down
1 change: 1 addition & 0 deletions concordium-std/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2657,6 +2657,7 @@ impl<A> UnwrapAbort for Option<A> {
type Unwrap = A;

#[inline(always)]
#[allow(clippy::redundant_closure)]
fn unwrap_abort(self) -> Self::Unwrap { self.unwrap_or_else(|| crate::trap()) }
}

Expand Down
2 changes: 1 addition & 1 deletion concordium-std/src/test_infrastructure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ pub struct TestHost<State> {
/// Functions that mock responses to calls.
// This is Rc+RefCell because it needs to be cloneable. There might be another way to make the
// MockFn cloneable, but this seemed like the easiest option.
mocking_fns: Rc<RefCell<MockFnMap<State>>>,
mocking_fns: Rc<RefCell<MockFnMap<State>>>,
/// Transfers the contract has made during its execution.
transfers: RefCell<Vec<(AccountAddress, Amount)>>,
/// The contract balance. This is updated during execution based on contract
Expand Down
8 changes: 4 additions & 4 deletions examples/icecream/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ enum ContractError {
#[from(TransferError)]
TransferError,
/// Failed contract invoke.
ContractError,
ContractInvokeError,
Unauthenticated,
}

impl<A> From<CallContractError<A>> for ContractError {
fn from(_: CallContractError<A>) -> Self { Self::ContractError }
fn from(_: CallContractError<A>) -> Self { Self::ContractInvokeError }
}

type ContractResult<A> = Result<A, ContractError>;
Expand Down Expand Up @@ -108,7 +108,7 @@ fn contract_buy_icecream<S: HasStateApi>(
let weather = if let Some(mut weather) = weather {
weather.get()?
} else {
return Err(ContractError::ContractError);
return Err(ContractError::ContractInvokeError);
};

match weather {
Expand Down Expand Up @@ -319,6 +319,6 @@ mod tests {

// Act + Assert (should panic)
let result = contract_buy_icecream(&ctx, &mut host, ICECREAM_PRICE);
claim_eq!(result, Err(ContractError::ContractError));
claim_eq!(result, Err(ContractError::ContractInvokeError));
}
}
2 changes: 1 addition & 1 deletion examples/nametoken/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ struct NameInfo<S: HasStateApi> {
// `StateBox` allows for lazy loading data; this is helpful
// in the situations when one wants to do a partial update not touching
// this field, which can be large.
data: StateBox<Vec<u8>, S>,
data: StateBox<Vec<u8>, S>,
}

impl<S: HasStateApi> NameInfo<S> {
Expand Down

0 comments on commit be31e22

Please sign in to comment.