Skip to content

Commit

Permalink
Audit all Penumbra todo items (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbuc authored May 14, 2024
1 parent eec44e1 commit 7213f1d
Show file tree
Hide file tree
Showing 25 changed files with 108 additions and 54 deletions.
3 changes: 2 additions & 1 deletion crates/relayer-cli/src/commands/evidence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ impl Runnable for EvidenceCmd {
ChainConfig::CosmosSdk(ref _cfg) => {
CosmosSdkChain::bootstrap(chain_config, rt.clone()).unwrap()
}
ChainConfig::Penumbra(_) => todo!(),
// TODO: Will need to rewrite this function to work with non-cosmosSDK chains
ChainConfig::Penumbra(_) => todo!("current implementation expects a cosmosSDK chain"),
};

let res = monitor_misbehaviours(
Expand Down
4 changes: 2 additions & 2 deletions crates/relayer-cli/src/commands/keys/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ pub fn add_key(
keyring.add_key(key_name, key_pair.clone())?;
key_pair.into()
}
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(_) => unimplemented!("no key storage support for penumbra"),
};

Ok(key_pair)
Expand Down Expand Up @@ -292,7 +292,7 @@ pub fn restore_key(
keyring.add_key(key_name, key_pair.clone())?;
key_pair.into()
}
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(_) => unimplemented!("no key storage support for penumbra"),
};

Ok(key_pair)
Expand Down
4 changes: 2 additions & 2 deletions crates/relayer-cli/src/commands/keys/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn get_balance(chain: impl ChainHandle, key_name: Option<String>, denom: Option<
match chain_config {
ChainConfig::CosmosSdk(chain_config) => chain_config.key_name,
ChainConfig::Astria(chain_config) => chain_config.key_name,
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(_) => unimplemented!("no key support for penumbra"),
}
});

Expand All @@ -102,7 +102,7 @@ fn get_balances(chain: impl ChainHandle, key_name: Option<String>) {
match chain_config {
ChainConfig::CosmosSdk(chain_config) => chain_config.key_name,
ChainConfig::Astria(chain_config) => chain_config.key_name,
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(_) => unimplemented!("no key support for penumbra"),
}
});

Expand Down
4 changes: 2 additions & 2 deletions crates/relayer-cli/src/commands/keys/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub fn delete_key(config: &ChainConfig, key_name: &str) -> eyre::Result<()> {
)?;
keyring.remove_key(key_name)?;
}
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(_) => unimplemented!("no key support for penumbra"),
}
Ok(())
}
Expand Down Expand Up @@ -160,7 +160,7 @@ pub fn delete_all_keys(config: &ChainConfig) -> eyre::Result<()> {
keyring.remove_key(&key_name)?;
}
}
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(_) => unimplemented!("no key support for penumbra"),
}
Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions crates/relayer-cli/src/commands/query/packet/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::{
prelude::*,
};

#[allow(dead_code)]
#[derive(Serialize, Debug)]
struct PacketSeqs {
height: Height,
Expand Down
5 changes: 4 additions & 1 deletion crates/relayer-cli/src/commands/tx/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ impl Runnable for TxUpdateClientCmd {
ChainConfig::CosmosSdk(chain_config) | ChainConfig::Astria(chain_config) => {
chain_config.genesis_restart = Some(restart_params)
}
ChainConfig::Penumbra(_) => todo!(),
// TODO: Will probably need to support setting restart params on Penumbra somehow
ChainConfig::Penumbra(_) => {
todo!("penumbra doesn't support genesis restart params")
}
},
None => {
Output::error(format!(
Expand Down
42 changes: 28 additions & 14 deletions crates/relayer/src/chain/penumbra/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use tendermint_proto::Protobuf;
use tracing::info;

use crate::chain::client::ClientSettings;
use crate::chain::cosmos::query::{abci_query, QueryResponse};
use crate::chain::cosmos::query::{abci_query, fetch_version_specs, QueryResponse};
use crate::chain::endpoint::ChainStatus;
use crate::chain::requests::*;
use crate::chain::tracking::TrackedMsgs;
Expand Down Expand Up @@ -587,7 +587,11 @@ impl ChainEndpoint for PenumbraChain {
}

fn shutdown(self) -> Result<(), Error> {
todo!()
if let Some(monitor_tx) = self.tx_monitor_cmd {
monitor_tx.shutdown().map_err(Error::event_source)?;
}

Ok(())
}

fn health_check(&mut self) -> Result<HealthCheck, Error> {
Expand Down Expand Up @@ -626,11 +630,11 @@ impl ChainEndpoint for PenumbraChain {
}

fn keybase(&self) -> &KeyRing<Self::SigningKeyPair> {
todo!()
unimplemented!("no key storage support for penumbra")
}

fn keybase_mut(&mut self) -> &mut KeyRing<Self::SigningKeyPair> {
todo!()
unimplemented!("no key storage support for penumbra")
}

fn get_signer(&self) -> Result<ibc_relayer_types::signer::Signer, Error> {
Expand All @@ -642,7 +646,13 @@ impl ChainEndpoint for PenumbraChain {
}

fn version_specs(&self) -> Result<crate::chain::cosmos::version::Specs, Error> {
todo!()
let version_specs = self.rt.block_on(fetch_version_specs(
self.id(),
&format!("{}", self.config.grpc_addr)
.parse::<Uri>()
.map_err(|_| Error::config(ConfigError::wrong_type()))?,
))?;
Ok(version_specs)
}

fn send_messages_and_wait_commit(
Expand Down Expand Up @@ -731,11 +741,11 @@ impl ChainEndpoint for PenumbraChain {
&self,
_key_name: Option<&str>,
) -> Result<Vec<crate::account::Balance>, Error> {
todo!()
unimplemented!("cannot query balance of a shielded chain >:}}")
}

fn query_denom_trace(&self, _hash: String) -> Result<crate::denom::DenomTrace, Error> {
todo!()
todo!("penumbra doesn't support denom trace querying yet")
}

fn query_commitment_prefix(
Expand Down Expand Up @@ -913,14 +923,14 @@ impl ChainEndpoint for PenumbraChain {
&self,
_request: QueryUpgradedClientStateRequest,
) -> Result<(AnyClientState, MerkleProof), Error> {
todo!()
todo!("need to implement corresponding state query in penumbra")
}

fn query_upgraded_consensus_state(
&self,
_request: QueryUpgradedConsensusStateRequest,
) -> Result<(AnyConsensusState, MerkleProof), Error> {
todo!()
todo!("need to implement corresponding state query in penumbra")
}

fn query_connections(
Expand Down Expand Up @@ -1445,7 +1455,7 @@ impl ChainEndpoint for PenumbraChain {
&self,
_request: QueryHostConsensusStateRequest,
) -> Result<Self::ConsensusState, Error> {
todo!()
todo!("need to implement corresponding state query on penumbra")
}

fn build_client_state(
Expand Down Expand Up @@ -1510,7 +1520,9 @@ impl ChainEndpoint for PenumbraChain {
_port_id: &ibc_relayer_types::core::ics24_host::identifier::PortId,
_counterparty_payee: &ibc_relayer_types::signer::Signer,
) -> Result<(), Error> {
todo!()
// the payee is an optional payee to which reverse and timeout relayer packet
// fees will be paid out.
todo!("currently unimplemented in penumbra")
}

fn cross_chain_query(
Expand All @@ -1520,18 +1532,20 @@ impl ChainEndpoint for PenumbraChain {
Vec<ibc_relayer_types::applications::ics31_icq::response::CrossChainQueryResponse>,
Error,
> {
todo!()
// https://github.com/cosmos/ibc/blob/main/spec/app/ics-031-crosschain-queries/README.md
todo!("not currently implemented in penumbra")
}

fn query_incentivized_packet(
&self,
_request: ibc_proto::ibc::apps::fee::v1::QueryIncentivizedPacketRequest,
) -> Result<ibc_proto::ibc::apps::fee::v1::QueryIncentivizedPacketResponse, Error> {
todo!()
// https://buf.build/cosmos/ibc/docs/e769eb46d1e742e8b0368510479161df:ibc.applications.fee.v1#ibc.applications.fee.v1.Query.IncentivizedPackets
todo!("not currently implemented in penumbra")
}

fn query_consumer_chains(&self) -> Result<Vec<(ChainId, ClientId)>, Error> {
todo!()
todo!("not currently implemented in penumbra")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl TestOverrides for Test {
// with external relayer commands.
chain_config.key_store_type = Store::Test;
}
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(_) => {}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl TestOverrides for Test {
// with external relayer commands.
chain_config.key_store_type = Store::Test;
}
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(_) => {}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl TestOverrides for Test {
// with external relayer commands.
chain_config.key_store_type = Store::Test;
}
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(_) => {}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion tools/integration-test/src/mbt/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ impl TestOverrides for IbcTransferMBT {
ChainConfig::CosmosSdk(chain_config) => {
chain_config.trusting_period = Some(CLIENT_EXPIRY);
}
ChainConfig::Penumbra(_) | ChainConfig::Astria(_) => todo!(),
ChainConfig::Penumbra(_chain_config) => {}
ChainConfig::Astria(_) => todo!(),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/integration-test/src/tests/async_icq/simple_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn assert_eventual_async_icq_success<ChainA: ChainHandle, ChainB: ChainHandle>(
) -> Result<(), Error> {
let rpc_addr = match relayer.config.chains.first().unwrap() {
ChainConfig::CosmosSdk(c) => c.rpc_addr.clone(),
ChainConfig::Penumbra(_c) => todo!(),
ChainConfig::Penumbra(c) => c.rpc_addr.clone(),
ChainConfig::Astria(_c) => todo!(),
};

Expand Down
2 changes: 1 addition & 1 deletion tools/integration-test/src/tests/clear_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ impl TestOverrides for ClearPacketOverrideTest {
match chain_config {
// Use a small clear interval in the chain configurations to override the global high interval
ChainConfig::CosmosSdk(chain_config) => chain_config.clear_interval = Some(10),
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(chain_config) => chain_config.clear_interval = Some(10),
ChainConfig::Astria(_) => todo!(),
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/integration-test/src/tests/client_expiration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl TestOverrides for ExpirationTestOverrides {
ChainConfig::CosmosSdk(chain_config) => {
chain_config.trusting_period = Some(CLIENT_EXPIRY);
}
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(_) => {}
ChainConfig::Astria(_) => todo!(),
}
}
Expand Down
12 changes: 10 additions & 2 deletions tools/integration-test/src/tests/client_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ impl TestOverrides for ClientDefaultsTest {
chain_config_a.trusting_period = Some(Duration::from_secs(120_000));
chain_config_a.trust_threshold = TrustThreshold::new(13, 23).unwrap();
}
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(chain_config_a) => {
chain_config_a.clock_drift = Duration::from_secs(3);
chain_config_a.max_block_time = Duration::from_secs(5);
chain_config_a.trust_threshold = TrustThreshold::new(13, 23).unwrap();
}
ChainConfig::Astria(_) => todo!(),
}

Expand All @@ -48,7 +52,11 @@ impl TestOverrides for ClientDefaultsTest {
chain_config_b.trusting_period = Some(Duration::from_secs(340_000));
chain_config_b.trust_threshold = TrustThreshold::TWO_THIRDS;
}
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(chain_config_b) => {
chain_config_b.clock_drift = Duration::from_secs(6);
chain_config_b.max_block_time = Duration::from_secs(15);
chain_config_b.trust_threshold = TrustThreshold::TWO_THIRDS;
}
ChainConfig::Astria(_) => todo!(),
}
}
Expand Down
8 changes: 6 additions & 2 deletions tools/integration-test/src/tests/dynamic_gas_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ impl TestOverrides for DynamicGasTest {
GasPrice::new(0.1, chain_config_a.gas_price.denom.clone());
chain_config_a.dynamic_gas_price = DynamicGasPrice::unsafe_new(false, 1.1, 0.6);
}
ChainConfig::Penumbra(_chain_config_a) => todo!(),
ChainConfig::Penumbra(_chain_config_a) => {
todo!("need to implement gas support for penumbra chains")
}
ChainConfig::Astria(_chain_config_a) => todo!(),
}

Expand All @@ -63,7 +65,9 @@ impl TestOverrides for DynamicGasTest {
chain_config_b.dynamic_gas_price =
DynamicGasPrice::unsafe_new(self.dynamic_gas_enabled, 1.1, 0.6);
}
ChainConfig::Penumbra(_chain_config_b) => todo!(),
ChainConfig::Penumbra(_chain_config_a) => {
todo!("need to implement gas support for penumbra chains")
}
ChainConfig::Astria(_chain_config_b) => todo!(),
}
}
Expand Down
8 changes: 6 additions & 2 deletions tools/integration-test/src/tests/fee/filter_fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ impl TestOverrides for FilterIncentivizedFeesRelayerTest {
ChainConfig::CosmosSdk(chain_config) => {
chain_config.packet_filter = packet_filter.clone();
}
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(chain_config) => {
chain_config.packet_filter = packet_filter.clone();
}
ChainConfig::Astria(_) => todo!(),
}
}
Expand Down Expand Up @@ -204,7 +206,9 @@ impl TestOverrides for FilterByChannelIncentivizedFeesRelayerTest {
ChainConfig::CosmosSdk(chain_config) => {
chain_config.packet_filter = packet_filter.clone();
}
ChainConfig::Penumbra(_) => todo!(),
ChainConfig::Penumbra(chain_config) => {
chain_config.packet_filter = packet_filter.clone();
}
ChainConfig::Astria(_) => todo!(),
}
}
Expand Down
12 changes: 9 additions & 3 deletions tools/integration-test/src/tests/fee_grant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ impl BinaryChannelTest for FeeGrantTest {
.ok_or_else(|| eyre!("chain configuration is empty"))?
{
ChainConfig::CosmosSdk(chain_config) => chain_config.gas_price.denom.clone(),
ChainConfig::Penumbra(_chain_config) => todo!(),
ChainConfig::Penumbra(_chain_config) => {
todo!("need to implement gas support for penumbra chains")
}
ChainConfig::Astria(_chain_config) => todo!(),
};

Expand All @@ -108,7 +110,9 @@ impl BinaryChannelTest for FeeGrantTest {
ChainConfig::CosmosSdk(c) => {
c.fee_granter = Some("user2".to_owned());
}
ChainConfig::Penumbra(_c) => todo!(),
ChainConfig::Penumbra(_chain_config) => {
todo!("need to implement gas support for penumbra chains")
}
ChainConfig::Astria(_c) => todo!(),
}
}
Expand Down Expand Up @@ -228,7 +232,9 @@ impl BinaryChannelTest for NoFeeGrantTest {
.ok_or_else(|| eyre!("chain configuration is empty"))?
{
ChainConfig::CosmosSdk(chain_config) => chain_config.gas_price.denom.clone(),
ChainConfig::Penumbra(_chain_config) => todo!(),
ChainConfig::Penumbra(_chain_config) => {
todo!("need to implement gas support for penumbra chains")
}
ChainConfig::Astria(_chain_config) => todo!(),
};

Expand Down
Loading

0 comments on commit 7213f1d

Please sign in to comment.