Skip to content

Commit

Permalink
piecrust: support bytecheck integrity check of arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
miloszm committed Feb 13, 2024
1 parent 2619a2e commit 182dfb9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions piecrust/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Change `call` and `feeder_call` functions to support `bytecheck`-based integrity check of arguments [#324]

### Added

- Add `Session::migrate` to allow for swapping contract code [#313]
Expand Down Expand Up @@ -360,6 +364,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- ISSUES -->
[#325]: https://github.com/dusk-network/piecrust/issues/325
[#324]: https://github.com/dusk-network/piecrust/issues/324
[#301]: https://github.com/dusk-network/piecrust/issues/313
[#301]: https://github.com/dusk-network/piecrust/issues/301
[#296]: https://github.com/dusk-network/piecrust/issues/296
Expand Down
2 changes: 2 additions & 0 deletions piecrust/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ impl Session {
) -> Result<CallReceipt<R>, Error>
where
A: for<'b> Serialize<StandardBufSerializer<'b>>,
A::Archived: for<'b> CheckBytes<DefaultValidator<'b>>,
R: Archive,
R::Archived: Deserialize<R, Infallible>
+ for<'b> CheckBytes<DefaultValidator<'b>>,
Expand Down Expand Up @@ -462,6 +463,7 @@ impl Session {
) -> Result<CallReceipt<R>, Error>
where
A: for<'b> Serialize<StandardBufSerializer<'b>>,
A::Archived: for<'b> CheckBytes<DefaultValidator<'b>>,
R: Archive,
R::Archived: Deserialize<R, Infallible>
+ for<'b> CheckBytes<DefaultValidator<'b>>,
Expand Down
6 changes: 3 additions & 3 deletions piecrust/tests/spender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub fn panic_msg_gets_through() -> Result<(), Error> {
let receipt = session.call::<_, Result<(), ContractError>>(
callcenter_id,
"call_spend_with_limit",
&(spender_id, 1000u64),
&(spender_id, 1175u64),
LIMIT,
)?;

Expand Down Expand Up @@ -125,8 +125,8 @@ pub fn contract_sets_call_limit() -> Result<(), Error> {
LIMIT,
)?;

const FIRST_LIMIT: u64 = 1000;
const SECOND_LIMIT: u64 = 2000;
const FIRST_LIMIT: u64 = 1175;
const SECOND_LIMIT: u64 = 2175;

let receipt = session_1st.call::<_, Result<(), ContractError>>(
callcenter_id,
Expand Down

0 comments on commit 182dfb9

Please sign in to comment.