forked from penumbra-zone/penumbra
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix penumbra-specific timestamp reads in ibc module (penumbra-zone#4822)
## Describe your changes fix penumbra-specific timestamp reads in ibc module by using `HostInterface` instead. - `Ics20WithdrawalWithHandler` was created analogously to `IbcRelayWithHandler`, which attaches a `HostInterface` to be used in `check_and_execute` to get the current block timestamp - the rpc method `client_state` was also updated to use `HostInterface` ## Issue ticket number and link closes penumbra-zone#4812 ## Checklist before requesting a review - [x] If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: > the timestamp reads are unchanged for penumbra, as the `PenumbraHost` is used, which calls the same methods as before --------- Co-authored-by: turbocrime <[email protected]>
- Loading branch information
1 parent
0c5afd9
commit 87adc8d
Showing
9 changed files
with
91 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
crates/core/component/shielded-pool/src/component/ics20_withdrawal_with_handler.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use crate::Ics20Withdrawal; | ||
use penumbra_ibc::component::HostInterface; | ||
use std::marker::PhantomData; | ||
|
||
pub struct Ics20WithdrawalWithHandler<HI>(Ics20Withdrawal, PhantomData<HI>); | ||
|
||
impl<HI> Ics20WithdrawalWithHandler<HI> { | ||
pub fn new(action: Ics20Withdrawal) -> Self { | ||
Self(action, PhantomData) | ||
} | ||
|
||
pub fn action(&self) -> &Ics20Withdrawal { | ||
&self.0 | ||
} | ||
|
||
pub fn into_inner(self) -> Ics20Withdrawal { | ||
self.0 | ||
} | ||
} | ||
|
||
impl<HI> From<Ics20WithdrawalWithHandler<HI>> for Ics20Withdrawal { | ||
fn from(value: Ics20WithdrawalWithHandler<HI>) -> Self { | ||
value.0 | ||
} | ||
} | ||
|
||
impl Ics20Withdrawal { | ||
pub fn with_handler<HI: HostInterface>(self) -> Ics20WithdrawalWithHandler<HI> { | ||
Ics20WithdrawalWithHandler::new(self) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters