Use MAX associated const (#9196)

* Use MAX associated const
This commit is contained in:
Squirrel
2021-06-24 11:53:49 +01:00
committed by GitHub
parent 09d9c2c9f6
commit ea1f21a904
56 changed files with 178 additions and 178 deletions
@@ -116,7 +116,7 @@ where
// storage_size cannot be zero because otherwise a contract that is just above
// the subsistence threshold does not pay rent given a large enough subsistence
// threshold. But we need rent payments to occur in order to benchmark for worst cases.
let storage_size = u32::max_value() / 10;
let storage_size = u32::MAX / 10;
// Endowment should be large but not as large to inhibit rent payments.
// Balance will only cover half the storage
@@ -334,7 +334,7 @@ where
///
/// If the contract supplied buffer is smaller than the passed `buffer` an `Err` is returned.
/// If `allow_skip` is set to true the contract is allowed to skip the copying of the buffer
/// by supplying the guard value of `u32::max_value()` as `out_ptr`. The
/// by supplying the guard value of `u32::MAX` as `out_ptr`. The
/// `weight_per_byte` is only charged when the write actually happens and is not skipped or
/// failed due to a too small output buffer.
pub fn write(
@@ -550,7 +550,7 @@ where
/// length of the buffer located at `out_ptr`. If that buffer is large enough the actual
/// `buf.len()` is written to this location.
///
/// If `out_ptr` is set to the sentinel value of `u32::max_value()` and `allow_skip` is true the
/// If `out_ptr` is set to the sentinel value of `u32::MAX` and `allow_skip` is true the
/// operation is skipped and `Ok` is returned. This is supposed to help callers to make copying
/// output optional. For example to skip copying back the output buffer of an `seal_call`
/// when the caller is not interested in the result.
@@ -570,7 +570,7 @@ where
create_token: impl FnOnce(u32) -> Option<RuntimeCosts>,
) -> Result<(), DispatchError>
{
if allow_skip && out_ptr == u32::max_value() {
if allow_skip && out_ptr == u32::MAX {
return Ok(());
}
@@ -892,7 +892,7 @@ define_env!(Env, <E: Ext>,
//
// The callees output buffer is copied to `output_ptr` and its length to `output_len_ptr`.
// The copy of the output buffer can be skipped by supplying the sentinel value
// of `u32::max_value()` to `output_ptr`.
// of `u32::MAX` to `output_ptr`.
//
// # Parameters
//
@@ -953,7 +953,7 @@ define_env!(Env, <E: Ext>,
// by the code hash. The address of this new account is copied to `address_ptr` and its length
// to `address_len_ptr`. The constructors output buffer is copied to `output_ptr` and its
// length to `output_len_ptr`. The copy of the output buffer and address can be skipped by
// supplying the sentinel value of `u32::max_value()` to `output_ptr` or `address_ptr`.
// supplying the sentinel value of `u32::MAX` to `output_ptr` or `address_ptr`.
//
// After running the constructor it is verified that the contract account holds at
// least the subsistence threshold. If that is not the case the instantiation fails and