Skip to content

Commit

Permalink
".git/.scripts/commands/fmt/fmt.sh"
Browse files Browse the repository at this point in the history
  • Loading branch information
command-bot committed Sep 23, 2024
1 parent 17e5dfa commit d1f70d2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
13 changes: 6 additions & 7 deletions substrate/frame/revive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,8 @@ pub mod pallet {

// We can use storage to store items using the available block ref_time with the
// `set_storage` host function.
let max_storage_size: u32 = ((max_block_ref_time
/ (<RuntimeCosts as gas::Token<T>>::weight(&RuntimeCosts::SetStorage {
let max_storage_size: u32 = ((max_block_ref_time /
(<RuntimeCosts as gas::Token<T>>::weight(&RuntimeCosts::SetStorage {
new_bytes: max_payload_size,
old_bytes: 0,
})
Expand All @@ -690,8 +690,8 @@ pub mod pallet {
// We can use storage to store events using the available block ref_time with the
// `deposit_event` host function. The overhead of stored events, which is around 100B,
// is not taken into account to simplify calculations, as it does not change much.
let max_events_size: u32 = ((max_block_ref_time
/ (<RuntimeCosts as gas::Token<T>>::weight(&RuntimeCosts::DepositEvent {
let max_events_size: u32 = ((max_block_ref_time /
(<RuntimeCosts as gas::Token<T>>::weight(&RuntimeCosts::DepositEvent {
num_topic: 0,
len: max_payload_size,
})
Expand Down Expand Up @@ -1049,9 +1049,8 @@ where
storage_deposit_limit.saturating_reduce(upload_deposit);
(executable, upload_deposit)
},
Code::Existing(code_hash) => {
(WasmBlob::from_storage(code_hash, &mut gas_meter)?, Default::default())
},
Code::Existing(code_hash) =>
(WasmBlob::from_storage(code_hash, &mut gas_meter)?, Default::default()),
};
let instantiate_origin = Origin::from_account_id(instantiate_account.clone());
let mut storage_meter =
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/revive/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ pub mod test_utils {
let code_info_len = CodeInfo::<Test>::max_encoded_len() as u64;
// Calculate deposit to be reserved.
// We add 2 storage items: one for code, other for code_info
DepositPerByte::get().saturating_mul(code_len as u64 + code_info_len)
+ DepositPerItem::get().saturating_mul(2)
DepositPerByte::get().saturating_mul(code_len as u64 + code_info_len) +
DepositPerItem::get().saturating_mul(2)
}
pub fn ensure_stored(code_hash: sp_core::H256) -> usize {
// Assert that code_info is stored
Expand Down
15 changes: 6 additions & 9 deletions substrate/frame/revive/src/wasm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,8 @@ impl<'a, E: Ext, M: PolkaVmInstance<E::T>> Runtime<'a, E, M> {
log::error!(target: LOG_TARGET, "polkavm execution error: {error}");
Some(Err(Error::<E::T>::ExecutionFailed.into()))
},
Ok(Finished) => {
Some(Ok(ExecReturnValue { flags: ReturnFlags::empty(), data: Vec::new() }))
},
Ok(Finished) =>
Some(Ok(ExecReturnValue { flags: ReturnFlags::empty(), data: Vec::new() })),
Ok(Trap) => Some(Err(Error::<E::T>::ContractTrapped.into())),
Ok(Segfault(_)) => Some(Err(Error::<E::T>::ExecutionFailed.into())),
Ok(NotEnoughGas) => Some(Err(Error::<E::T>::OutOfGas.into())),
Expand All @@ -586,12 +585,11 @@ impl<'a, E: Ext, M: PolkaVmInstance<E::T>> Runtime<'a, E, M> {
instance.write_output(return_value);
None
},
Err(TrapReason::Return(ReturnData { flags, data })) => {
Err(TrapReason::Return(ReturnData { flags, data })) =>
match ReturnFlags::from_bits(flags) {
None => Some(Err(Error::<E::T>::InvalidCallFlags.into())),
Some(flags) => Some(Ok(ExecReturnValue { flags, data })),
}
},
},
Err(TrapReason::Termination) => Some(Ok(Default::default())),
Err(TrapReason::SupervisorError(error)) => Some(Err(error.into())),
}
Expand Down Expand Up @@ -1740,9 +1738,8 @@ pub mod env {
Environment::new(self, memory, id, input_ptr, input_len, output_ptr, output_len_ptr);
let ret = match chain_extension.call(env)? {
RetVal::Converging(val) => Ok(val),
RetVal::Diverging { flags, data } => {
Err(TrapReason::Return(ReturnData { flags: flags.bits(), data }))
},
RetVal::Diverging { flags, data } =>
Err(TrapReason::Return(ReturnData { flags: flags.bits(), data })),
};
self.chain_extension = Some(chain_extension);
ret
Expand Down

0 comments on commit d1f70d2

Please sign in to comment.