Skip to content

Commit

Permalink
Change checks for async messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Besancon committed Jun 14, 2024
1 parent d29eb55 commit 9b497eb
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions massa-execution-worker/src/interface_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1188,11 +1188,6 @@ impl Interface for InterfaceImpl {
bail!("max gas is lower than the minimum instance cost")
}

if Slot::new(validity_end.0, validity_end.1) < Slot::new(validity_start.0, validity_start.1)
{
bail!("validity end is earlier than the validity start")
}

let target_addr = Address::from_str(target_address)?;

// check that the target address is an SC address
Expand All @@ -1211,8 +1206,12 @@ impl Interface for InterfaceImpl {
let mut execution_context = context_guard!(self);
let emission_slot = execution_context.slot;

if emission_slot > Slot::new(validity_start.0, validity_start.1) {
bail!("validity start is earlier than the current slot")
if Slot::new(validity_end.0, validity_end.1) < Slot::new(validity_start.0, validity_start.1)
{
bail!("validity end is earlier than the validity start")
}
if Slot::new(validity_end.0, validity_end.1) < emission_slot {
bail!("validity end is earlier than the current slot")
}

let emission_index = execution_context.created_message_index;
Expand Down

0 comments on commit 9b497eb

Please sign in to comment.