Skip to content

Commit

Permalink
Addressed first round PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Jun 28, 2023
1 parent ff024fc commit 0a7f563
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion contracts/consumer/converter/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl ConverterContract<'_> {
admin: Option<String>,
) -> Result<Response, ContractError> {
nonpayable(&ctx.info)?;
// valdiate args
// validate args
if discount > Decimal::one() {
return Err(ContractError::InvalidDiscount);
}
Expand Down
12 changes: 5 additions & 7 deletions contracts/provider/external-staking/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ impl ExternalStakingContract<'_> {
data: to_binary(&packet)?,
timeout: packet_timeout(&ctx.env),
};
// send packet if we are ibc enabled (skip in tests)
// send packet if we are ibc enabled
// TODO: send in test code when we can handle it
#[cfg(not(test))]
{
resp = resp.add_message(msg);
Expand Down Expand Up @@ -750,13 +751,10 @@ impl ExternalStakingContract<'_> {
self.pending_txs.remove(deps.storage, tx_id);

// Verify tx is of the right type and get data
let (_amount, staker, validator) = match tx {
let (staker, validator) = match tx {
Tx::InFlightTransferFunds {
amount,
staker,
validator,
..
} => (amount, staker, validator),
staker, validator, ..
} => (staker, validator),
_ => {
return Err(ContractError::WrongTypeTx(tx_id, tx));
}
Expand Down
12 changes: 1 addition & 11 deletions contracts/provider/external-staking/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub fn ibc_packet_ack(
.add_attribute("tx_id", tx_id.to_string());
}
(ProviderPacket::TransferRewards { tx_id, .. }, AckWrapper::Result(_)) => {
// Any events to add?
// TODO: Any events to add?
contract.commit_withdraw_rewards(deps, tx_id)?;
}
(ProviderPacket::TransferRewards { tx_id, .. }, AckWrapper::Error(e)) => {
Expand All @@ -213,16 +213,6 @@ pub fn ibc_packet_ack(
.add_attribute("packet", msg.original_packet.sequence.to_string());
}
}

// Question: do we need a special event with all this info on error?

// // Provide info to find the actual packet.
// let event = Event::new("mesh_ibc_error")
// .add_attribute("error", e)
// .add_attribute("channel", msg.original_packet.src.channel_id)
// .add_attribute("sequence", msg.original_packet.sequence.to_string());
// resp = resp.add_event(event);
// }
Ok(resp)
}

Expand Down
2 changes: 1 addition & 1 deletion docs/ibc/Rewards.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ that should be distributed among all stakers on the given validators. It is up t
must guarantee to hold `rewards` tokens in reserve to be released by future IBC packets
on this channel.

The provider side has a new variant `ProviderPacket::TransferFunds {}` which specifies the
The provider side has a new variant `ProviderPacket::TransferRewards {}` which specifies the
among and the recipient address on the consumer chain. If the converter contract hold those
tokens in reserve (always in the case of a correct provider chain), it must release
them to the given address. The consumer chain must be designed to handle rollbacks here
Expand Down
4 changes: 1 addition & 3 deletions packages/sync/src/txs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub enum Tx {
/// Remote staking contract
lienholder: Addr,
},
// IBC flight
InFlightRemoteStaking {
/// Transaction id
id: u64,
Expand All @@ -27,7 +26,6 @@ pub enum Tx {
/// Remote validator
validator: String,
},
// IBC flight
InFlightRemoteUnstaking {
/// Transaction id
id: u64,
Expand All @@ -47,7 +45,7 @@ pub enum Tx {
staker: Addr,
/// The validator whose rewards they come from (to revert)
validator: String,
}, // InFlightSlashing
},
}

impl Tx {
Expand Down

0 comments on commit 0a7f563

Please sign in to comment.