Skip to content

Commit

Permalink
floating
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Apr 26, 2022
1 parent bb53182 commit 06b2df5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions runtime-sdk/src/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl<R: Runtime> Dispatcher<R> {
R::Modules::execute_in_msg(ctx, in_msg, data, tx)?;
if let Some(tx) = tx {
let tx_size = match data
.ut
.tx
.as_ref()
.unwrap_or_else(|| panic!("incoming message {} has tx but no ut", in_msg.id))
.len()
Expand Down Expand Up @@ -561,7 +561,7 @@ impl<R: Runtime + Send + Sync> transaction::dispatcher::Dispatcher for Dispatche
warn!(ctx.get_logger("dispatcher"), "incoming message data malformed"; "id" => in_msg.id, "err" => ?err);
IncomingMessageData::noop()
});
let tx = data.ut.as_ref().and_then(|ut| Self::decode_tx(ctx, ut).map_err(|err| {
let tx = data.tx.as_ref().and_then(|tx| Self::decode_tx(ctx, tx).map_err(|err| {
warn!(ctx.get_logger("dispatcher"), "incoming message transaction malformed"; "id" => in_msg.id, "err" => ?err);
}).ok());
if prefetch_enabled {
Expand Down Expand Up @@ -629,9 +629,9 @@ impl<R: Runtime + Send + Sync> transaction::dispatcher::Dispatcher for Dispatche
warn!(ctx.get_logger("dispatcher"), "incoming message data malformed"; "id" => in_msg.id, "err" => ?err);
IncomingMessageData::noop()
});
let tx = match data.ut.as_ref() {
Some(ut) => {
match Self::decode_tx(ctx, ut) {
let tx = match data.tx.as_ref() {
Some(tx) => {
match Self::decode_tx(ctx, tx) {
Ok(tx) => {
let remaining_gas = R::Core::remaining_in_msgs_gas(ctx);
if remaining_gas < cfg.min_remaining_gas {
Expand Down
6 changes: 3 additions & 3 deletions runtime-sdk/src/types/in_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ pub enum Error {
pub struct IncomingMessageData {
#[cbor(rename = "v")]
pub version: u16,
/// An embedded transaction (UnverifiedTransaction).
/// An embedded transaction (UnverifiedTransaction in runtimes using this SDK).
/// The transaction doesn't need to be from the same account that sent the message.
pub ut: Option<Vec<u8>>,
pub tx: Option<Vec<u8>>,
}

impl IncomingMessageData {
pub fn noop() -> Self {
Self {
version: LATEST_INCOMING_MESSAGE_VERSION,
ut: None,
tx: None,
}
}

Expand Down

0 comments on commit 06b2df5

Please sign in to comment.