// Store received acknowledgment for later processing
#[entry_point]
pub fn sudo(deps: DepsMut, env: Env, msg: SudoMsg) -> Result<Response, ContractError> {
match msg {
SudoMsg::IbcAcknowledgement { ack, .. } => {
// Just store the acknowledgment with minimal processing
PENDING_ACKS.save(deps.storage, &ack)?;
Ok(Response::new().add_attribute("action", "ack_stored"))
},
_ => Err(ContractError::UnknownSudoMsg {}),
}
}
// Process stored acknowledgments with separate message
#[entry_point]
pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> Result<Response, ContractError> {
match msg {
ExecuteMsg::ProcessPendingAcks {} => {
let acks = PENDING_ACKS.load(deps.storage)?;
// Process acks with full gas available
// ...
Ok(Response::new().add_attribute("action", "processed_acks"))
},
// Handle resubmission of failures
ExecuteMsg::ResubmitFailure { id } => {
Ok(Response::new()
.add_message(NeutronMsg::ResubmitFailure { failure_id: id })
.add_attribute("action", "resubmit"))
},
// Other execute messages
// ...
}
}