Skip to content

Commit

Permalink
fix(storage): indicate max pin count in error
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeneux committed Mar 8, 2023
1 parent ce24a0a commit 4bb1af0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ description = "Run all unit tests."
env = { LLVM_PROFILE_FILE = "default.profraw", RUST_BACKTRACE = 1 }

[tasks.test-coverage]
dependencies = ["install-tarpaulin"]
command = "cargo"
args = ["tarpaulin", "-o", "lcov"]
command = "cargo"
dependencies = ["install-tarpaulin"]

[tasks.install_wasm]
script = '''
Expand Down
6 changes: 3 additions & 3 deletions contracts/cw-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ panic = 'abort'
rpath = false

[dependencies]
base16ct = "0.1.1"
cosmwasm-schema.workspace = true
cosmwasm-std.workspace = true
cosmwasm-storage.workspace = true
cw-storage-plus.workspace = true
cw2.workspace = true
schemars.workspace = true
serde.workspace = true
thiserror.workspace = true
sha2 = "0.10.6"
base16ct = "0.1.1"
thiserror.workspace = true

[dev-dependencies]
cw-multi-test.workspace = true
base64 = "0.21.0"
cw-multi-test.workspace = true

[features]
# for more explicit tests, cargo test --features=backtraces
Expand Down
9 changes: 7 additions & 2 deletions contracts/cw-storage/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ pub mod execute {
Limits {
max_object_pins: Some(max),
..
} if max < o.pin_count => Err(BucketError::MaxObjectPinsLimitExceeded.into()),
} if max < o.pin_count => {
Err(BucketError::MaxObjectPinsLimitExceeded(o.pin_count, max).into())
}
_ => {
pins().save(
deps.storage,
Expand Down Expand Up @@ -777,7 +779,10 @@ mod tests {
mock_info("pierre", &[]),
],
expected_count: 3,
expected_error: Some(ContractError::Bucket(MaxObjectPinsLimitExceeded)),
expected_error: Some(ContractError::Bucket(MaxObjectPinsLimitExceeded(
Uint128::new(3),
Uint128::new(2),
))),
expected_object_pin_count: vec![
(
ObjectId::from(
Expand Down

0 comments on commit 4bb1af0

Please sign in to comment.