Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the IBC native VP #1927

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changelog/unreleased/improvements/1927-move-ibc-vp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Move the IBC native VP to a different module
([\#1927](https://github.com/anoma/namada/pull/1927))
2 changes: 1 addition & 1 deletion benches/native_vps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use namada::ibc::core::ics24_host::identifier::{
};
use namada::ledger::gas::{TxGasMeter, VpGasMeter};
use namada::ledger::governance::GovernanceVp;
use namada::ledger::ibc::vp::Ibc;
use namada::ledger::native_vp::ibc::Ibc;
use namada::ledger::native_vp::multitoken::MultitokenVp;
use namada::ledger::native_vp::replay_protection::ReplayProtectionVp;
use namada::ledger::native_vp::{Ctx, NativeVp};
Expand Down
2 changes: 0 additions & 2 deletions shared/src/ledger/ibc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! IBC integration

pub use namada_core::ledger::ibc::storage;
pub mod vp;

use namada_core::ledger::ibc::storage::{
channel_counter_key, client_counter_key, connection_counter_key,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ mod tests {
use prost::Message;
use sha2::Digest;

use super::super::storage::{
use super::*;
use crate::core::ledger::ibc::storage::{
ack_key, calc_hash, channel_counter_key, channel_key,
client_connections_key, client_counter_key, client_state_key,
client_update_height_key, client_update_timestamp_key, commitment_key,
connection_counter_key, connection_key, consensus_state_key,
ibc_denom_key, next_sequence_ack_key, next_sequence_recv_key,
next_sequence_send_key, receipt_key,
};
use super::{get_dummy_header, *};
use crate::core::ledger::storage::testing::TestWlStorage;
use crate::core::types::address::testing::{
established_address_1, established_address_2,
Expand Down
1 change: 1 addition & 0 deletions shared/src/ledger/native_vp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//! as the PoS and IBC modules.

pub mod ethereum_bridge;
pub mod ibc;
pub mod multitoken;
pub mod parameters;
pub mod replay_protection;
Expand Down
4 changes: 2 additions & 2 deletions shared/src/ledger/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ use thiserror::Error;

use crate::ledger::gas::{self, GasMetering, VpGasMeter};
use crate::ledger::governance::GovernanceVp;
use crate::ledger::ibc::vp::Ibc;
use crate::ledger::native_vp::ethereum_bridge::bridge_pool_vp::BridgePoolVp;
use crate::ledger::native_vp::ethereum_bridge::nut::NonUsableTokens;
use crate::ledger::native_vp::ethereum_bridge::vp::EthBridge;
use crate::ledger::native_vp::ibc::Ibc;
use crate::ledger::native_vp::multitoken::MultitokenVp;
use crate::ledger::native_vp::parameters::{self, ParametersVp};
use crate::ledger::native_vp::replay_protection::ReplayProtectionVp;
Expand Down Expand Up @@ -66,7 +66,7 @@ pub enum Error {
#[error("The address {0} doesn't exist")]
MissingAddress(Address),
#[error("IBC native VP: {0}")]
IbcNativeVpError(crate::ledger::ibc::vp::Error),
IbcNativeVpError(crate::ledger::native_vp::ibc::Error),
#[error("PoS native VP: {0}")]
PosNativeVpError(pos::vp::Error),
#[error("PoS native VP panicked")]
Expand Down
6 changes: 3 additions & 3 deletions tests/src/vm_host_env/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub use namada::ledger::ibc::storage::{
consensus_state_key, ibc_token, next_sequence_ack_key,
next_sequence_recv_key, next_sequence_send_key, port_key, receipt_key,
};
use namada::ledger::ibc::vp::{
use namada::ledger::native_vp::ibc::{
get_dummy_genesis_validator, get_dummy_header as tm_dummy_header, Ibc,
};
use namada::ledger::native_vp::multitoken::{
Expand Down Expand Up @@ -101,7 +101,7 @@ impl<'a> TestIbcVp<'a> {
pub fn validate(
&self,
tx_data: &Tx,
) -> std::result::Result<bool, namada::ledger::ibc::vp::Error> {
) -> std::result::Result<bool, namada::ledger::native_vp::ibc::Error> {
self.ibc.validate_tx(
tx_data,
self.ibc.ctx.keys_changed,
Expand Down Expand Up @@ -132,7 +132,7 @@ impl<'a> TestMultitokenVp<'a> {
pub fn validate_ibc_vp_from_tx<'a>(
tx_env: &'a TestTxEnv,
tx: &'a Tx,
) -> std::result::Result<bool, namada::ledger::ibc::vp::Error> {
) -> std::result::Result<bool, namada::ledger::native_vp::ibc::Error> {
let (verifiers, keys_changed) = tx_env
.wl_storage
.write_log
Expand Down
2 changes: 1 addition & 1 deletion tests/src/vm_host_env/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mod tests {
use itertools::Itertools;
use namada::ibc::core::Msg;
use namada::ledger::ibc::storage as ibc_storage;
use namada::ledger::ibc::vp::{
use namada::ledger::native_vp::ibc::{
get_dummy_header as tm_dummy_header, Error as IbcError,
};
use namada::ledger::tx_env::TxEnv;
Expand Down