Skip to content

Commit

Permalink
Merge branch 'master' into Write-a-README-for-factory-contract-and-cr…
Browse files Browse the repository at this point in the history
…oss-contract-examples
  • Loading branch information
MattCS2006 authored Sep 18, 2024
2 parents 80093eb + f179a28 commit e21012e
Show file tree
Hide file tree
Showing 20 changed files with 359 additions and 158 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Coverage
on:
push:
branches:
- master
pull_request:
env:
RUSTFLAGS: "-D warnings"

jobs:
coverage:
runs-on: ${{ matrix.platform }}
name: "${{ matrix.example }} - ${{ matrix.platform }}"
strategy:
matrix:
platform: [macos-latest]
toolchain: [stable]
steps:
- uses: actions/checkout@v3
- name: Install Homebrew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: Install LLVM
run: brew install llvm
- name: Add LLVM to PATH
run: echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH
- name: Install cargo-llvm-cov
run: brew install cargo-llvm-cov
- name: Llvm version
run: llvm-config --version
- name: Clang version
run: clang --version
- name: "${{ matrix.toolchain }} with rustfmt, and wasm32"
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
target: wasm32-unknown-unknown
- name: Set Default Toolchain
run: rustup override set ${{ matrix.toolchain }}
- name: Rust version
run: rustc --version --verbose
- name: Add rust-src component
run: rustup component add rust-src --toolchain ${{ matrix.toolchain }}
- name: Verify Rust Toolchain
run: rustup show
- name: Generate code coverage
run: cargo +${{ matrix.toolchain }} llvm-cov --lcov --output-path llvm-cov-output.lcov
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./llvm-cov-output.lcov
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
matrix:
platform:
- os: ubuntu-latest
rs: 1.76.0
rs: 1.79
- os: ubuntu-latest
rs: stable
- os: macos-latest
rs: 1.76.0
rs: 1.79
- os: macos-latest
rs: stable
features: ['', '--features unstable,legacy,__abi-generate']
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@

## [Unreleased]

## [5.5.0](https://github.com/near/near-sdk-rs/compare/near-sdk-v5.4.0...near-sdk-v5.5.0) - 2024-09-11

### Other

- Updated near-* dependendencies to v0.26.0. Migrated testing blockchain mock to C-unwind ([#1244](https://github.com/near/near-sdk-rs/pull/1244))

## [5.4.0](https://github.com/near/near-sdk-rs/compare/near-sdk-v5.3.0...near-sdk-v5.4.0) - 2024-09-04

### Other
- updates near-* dependencies to 0.25.0 ([#1242](https://github.com/near/near-sdk-rs/pull/1242))
- updates near-workspaces-rs ([#1239](https://github.com/near/near-sdk-rs/pull/1239))

## [5.3.0](https://github.com/near/near-sdk-rs/compare/near-sdk-v5.2.1...near-sdk-v5.3.0) - 2024-08-13

### Added
- Introduced 'remove' method for 'near_sdk::store::Lazy' collection ([#1238](https://github.com/near/near-sdk-rs/pull/1238))
- Allow store collection iterators to be cloned (this enables standard Iterator methods like `cycle()`) ([#1224](https://github.com/near/near-sdk-rs/pull/1224))

### Fixed
- Fix storage management error message with proper amount ([#1222](https://github.com/near/near-sdk-rs/pull/1222))
- Fixed compilation errors after Rust 1.80 latest stable release ([#1227](https://github.com/near/near-sdk-rs/pull/1227))

### Other
- updates near-* dependencies to 0.24.0 ([#1237](https://github.com/near/near-sdk-rs/pull/1237))
- Include all examples into CI testing suite ([#1228](https://github.com/near/near-sdk-rs/pull/1228))
- Optimized up to 10% contract binary size by using `near_sdk::env::panic_str` instead of `expect` calls ([#1220](https://github.com/near/near-sdk-rs/pull/1220))
- Fixed Rust 1.80 new warning by adding `cargo:rustc-check-cfg` for `__abi-embed-checked` feature in `near-sdk-macros` build.rs ([#1225](https://github.com/near/near-sdk-rs/pull/1225))

## [5.2.1](https://github.com/near/near-sdk-rs/compare/near-sdk-v5.2.0...near-sdk-v5.2.1) - 2024-07-05

### Fixed
Expand Down
9 changes: 2 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
[workspace]
resolver = "2"
members = [
"near-sdk",
"near-sdk-macros",
"near-contract-standards",
"near-sys",
]
members = ["near-sdk", "near-sdk-macros", "near-contract-standards", "near-sys"]
exclude = ["examples/"]

[workspace.package]
version = "5.2.1"
version = "5.5.0"

# Special triple # comment for ci.
[patch.crates-io]
Expand Down
2 changes: 1 addition & 1 deletion examples/adder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crate-type = ["cdylib"]
near-sdk = { path = "../../near-sdk" }

[dev-dependencies]
near-workspaces = "0.11.0"
near-workspaces = "0.14"
tokio = { version = "1.14", features = ["full"] }
anyhow = "1.0"
near-abi = "0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/callback-results/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crate-type = ["cdylib"]
near-sdk = { path = "../../near-sdk" }

[dev-dependencies]
near-workspaces = "0.11.0"
near-workspaces = "0.14"
tokio = { version = "1.14", features = ["full"] }
anyhow = "1.0"
near-sdk = { path = "../../near-sdk", features = ["unit-testing"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/cross-contract-calls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ anyhow = "1.0"
near-sdk = { path = "../../near-sdk", features = ["default", "unit-testing"] }
test-case = "2.0"
tokio = { version = "1.14", features = ["full"] }
near-workspaces = "0.11.0"
near-workspaces = "0.14"

cross-contract-high-level = { path = "./high-level" }
cross-contract-low-level = { path = "./low-level" }
Expand Down
2 changes: 1 addition & 1 deletion examples/factory-contract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
anyhow = "1.0"
test-case = "2.0"
tokio = { version = "1.14", features = ["full"] }
near-workspaces = "0.11.0"
near-workspaces = "0.14"
near-sdk = { path = "../../near-sdk", features = ["unit-testing"] }

[profile.release]
Expand Down
2 changes: 1 addition & 1 deletion examples/fungible-token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
anyhow = "1.0"
near-sdk = { path = "../../near-sdk", features = ["unit-testing"] }
tokio = { version = "1.14", features = ["full"] }
near-workspaces = "0.11.0"
near-workspaces = "0.14"

[profile.release]
codegen-units = 1
Expand Down
2 changes: 1 addition & 1 deletion examples/lockable-fungible-token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ near-sdk = { path = "../../near-sdk", features = ["legacy"] }
anyhow = "1.0"
tokio = { version = "1.14", features = ["full"] }
near-sdk = { path = "../../near-sdk", features = ["unit-testing"] }
near-workspaces = "0.11.0"
near-workspaces = "0.14"

[profile.release]
codegen-units = 1
Expand Down
4 changes: 2 additions & 2 deletions examples/non-fungible-token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ edition = "2021"
[dev-dependencies]
anyhow = "1.0"
near-contract-standards = { path = "../../near-contract-standards" }
near-sdk = { path = "../../near-sdk", features = ["unit-testing"] }
near-sdk = { path = "../../near-sdk", features = ["unit-testing"] }
tokio = { version = "1.14", features = ["full"] }
near-workspaces = "0.11.0"
near-workspaces = "0.14"

[profile.release]
codegen-units = 1
Expand Down
11 changes: 11 additions & 0 deletions near-contract-standards/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [5.5.0](https://github.com/near/near-sdk-rs/compare/near-contract-standards-v5.4.0...near-contract-standards-v5.5.0) - 2024-09-11

### Other

- Updated near-* dependendencies to v0.26.0. Migrated testing blockchain mock to C-unwind ([#1244](https://github.com/near/near-sdk-rs/pull/1244))

## [5.3.0](https://github.com/near/near-sdk-rs/compare/near-contract-standards-v5.2.1...near-contract-standards-v5.3.0) - 2024-08-13

### Fixed
- Fix storage management error message with proper amount ([#1222](https://github.com/near/near-sdk-rs/pull/1222))

## [5.2.0](https://github.com/near/near-sdk-rs/compare/near-contract-standards-v5.1.0...near-contract-standards-v5.2.0) - 2024-07-04

### Added
Expand Down
8 changes: 6 additions & 2 deletions near-contract-standards/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ NEAR smart contracts standard library.
"""

[dependencies]
near-sdk = { path = "../near-sdk", version = "~5.2.1", default-features = false, features = ["legacy"] }
near-sdk = { path = "../near-sdk", version = "~5.5.0", default-features = false, features = [
"legacy",
] }

[dev-dependencies]
near-sdk = { path = "../near-sdk", default-features = false, features = ["unit-testing"] }
near-sdk = { path = "../near-sdk", default-features = false, features = [
"unit-testing",
] }

[features]
default = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,7 @@ impl NonFungibleTokenResolver for NonFungibleToken {
// Get whether token should be returned
let must_revert = match env::promise_result(0) {
PromiseResult::Successful(value) => {
if let Ok(yes_or_no) = near_sdk::serde_json::from_slice::<bool>(&value) {
yes_or_no
} else {
true
}
near_sdk::serde_json::from_slice::<bool>(&value).unwrap_or(true)
}
PromiseResult::Failed => true,
};
Expand Down
20 changes: 10 additions & 10 deletions near-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ required-features = ["abi", "unstable"]
# Provide near_bidgen macros.
serde = { version = "1", features = ["derive"] }
serde_json = "1"
near-sdk-macros = { path = "../near-sdk-macros", version = "~5.2.1" }
near-sdk-macros = { path = "../near-sdk-macros", version = "~5.5.0" }
near-sys = { path = "../near-sys", version = "0.2.2" }
base64 = "0.21"
base64 = "0.22"
borsh = { version = "1.0.0", features = ["derive"] }
bs58 = "0.5"

# Used for caching, might be worth porting only functionality needed.
once_cell = { version = "1.17", default-features = false }

near-account-id = { version = "1.0.0", features = ["serde", "borsh"] }
near-gas = { version = "0.2.3", features = ["serde", "borsh"] }
near-token = { version = "0.2.1", features = ["serde", "borsh"] }
near-gas = { version = "0.3", features = ["serde", "borsh"] }
near-token = { version = "0.3", features = ["serde", "borsh"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
wee_alloc = { version = "0.4.5", default-features = false, optional = true }
Expand All @@ -42,11 +42,11 @@ schemars = { version = "0.8.8", optional = true }
near-abi = { version = "0.4.0", features = [
"__chunked-entries",
], optional = true }
near-vm-runner = { version = "0.23", optional = true }
near-primitives-core = { version = "0.23", optional = true }
near-primitives = { version = "0.23", optional = true }
near-crypto = { version = "0.23", default-features = false, optional = true }
near-parameters = { version = "0.23", optional = true }
near-vm-runner = { version = "0.26", optional = true }
near-primitives-core = { version = "0.26", optional = true }
near-primitives = { version = "0.26", optional = true }
near-crypto = { version = "0.26", default-features = false, optional = true }
near-parameters = { version = "0.26", optional = true }

[dev-dependencies]
near-sdk = { path = ".", features = ["legacy", "unit-testing"] }
Expand All @@ -63,7 +63,7 @@ rand_chacha = "0.3.1"
near-rng = "0.1.1"
near-abi = { version = "0.4.0", features = ["__chunked-entries"] }
symbolic-debuginfo = "12"
near-workspaces = { version = "0.10.1", features = ["unstable"] }
near-workspaces = { version = "0.14", features = ["unstable"] }
anyhow = "1.0"
tokio = { version = "1", features = ["full"] }
strum = "0.25.0"
Expand Down
5 changes: 3 additions & 2 deletions near-sdk/compilation_tests/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ fn compilation_tests() {
t.pass("compilation_tests/function_error.rs");
t.pass("compilation_tests/enum_near_bindgen.rs");
t.pass("compilation_tests/schema_derive.rs");
if rustversion::cfg!(since(1.78)) && std::env::consts::OS == "linux" {
// The compilation error output has slightly changed in 1.7x and between platforms,

if rustversion::cfg!(since(1.80)) && std::env::consts::OS == "linux" {
// The compilation error output has slightly changed in 1.7x and 1.8x and between platforms,
// so we snapshoted this single version
t.compile_fail("compilation_tests/schema_derive_invalids.rs");
}
Expand Down
Loading

0 comments on commit e21012e

Please sign in to comment.