Skip to content

Commit

Permalink
fix to gears after refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
NYBACHOK committed Nov 7, 2024
1 parent e86bf72 commit aa344f9
Show file tree
Hide file tree
Showing 10 changed files with 2,537 additions and 87 deletions.
2,549 changes: 2,495 additions & 54 deletions Cargo.lock

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ members = [
"trees",
"kv_store",
"keyring",
# "gears",
"gears",

# # macros
# "macros/tx-derive",
# "macros/query-derive",
# "macros/protobuf-derive",
# "macros/key-derive",
"macros/tx-derive",
"macros/query-derive",
"macros/protobuf-derive",
"macros/key-derive",

# GAIA
# "gaia-rs",
"gaia-rs",

# xmodules
# "x/auth",
# "x/bank",
# "x/distribution",
# "x/evidence",
# "x/gov",
# "x/ibc-rs",
# "x/slashing",
# "x/staking",
# "x/genutil",
# "x/upgrade",
# "x/mint",
"x/auth",
"x/bank",
"x/distribution",
"x/evidence",
"x/gov",
"x/ibc-rs",
"x/slashing",
"x/staking",
"x/genutil",
"x/upgrade",
"x/mint",

# new unsorted
]
Expand Down
14 changes: 9 additions & 5 deletions gears/src/baseapp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pub mod options;
use std::{
fmt::Debug,
marker::PhantomData,
num::NonZero,
sync::{Arc, RwLock},
};

Expand Down Expand Up @@ -104,13 +105,16 @@ impl<DB: Database, PSK: ParamsSubspaceKey, H: ABCIHandler, AI: ApplicationInfo>

fn run_query(&self, request: &RequestQuery) -> Result<Bytes, QueryError> {
//TODO: request height u32
let version: u32 = request
.height
.try_into()
.map_err(|_| QueryError::InvalidHeight)?;
let version: NonZero<u32> = NonZero::new(
request
.height
.try_into()
.map_err(|_| QueryError::InvalidHeight)?,
)
.ok_or(QueryError::InvalidHeight)?;

let store = self.multi_store.read().expect(POISONED_LOCK);
let ctx = QueryContext::new(QueryMultiStore::new(&*store, version)?, version)?;
let ctx = QueryContext::new(QueryMultiStore::new(&*store, Some(version))?, version.get())?;

self.abci_handler
.query(&ctx, request.clone())
Expand Down
7 changes: 6 additions & 1 deletion gears/src/baseapp/query.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::num::NonZero;

use database::Database;
use kv_store::query::QueryMultiStore;
use serde::Serialize;
Expand Down Expand Up @@ -37,7 +39,10 @@ impl<DB: Database, PSK: ParamsSubspaceKey, H: ABCIHandler, AI: ApplicationInfo>
let version = request.height();

let store = self.multi_store.read().expect(POISONED_LOCK);
let ctx = QueryContext::new(QueryMultiStore::new(&*store, version)?, version)?;
let ctx = QueryContext::new(
QueryMultiStore::new(&*store, NonZero::new(version))?,
version,
)?;
Ok(self.abci_handler.typed_query(&ctx, request))
}
}
Expand Down
4 changes: 2 additions & 2 deletions gears/src/types/auth/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use crate::types::base::errors::CoinsError;
use super::gas::{Gas, GasError};

pub mod inner {
pub use core_types::auth::fee::Fee;
pub use core_types::base::coin::Coin;
pub use core_types::auth::Fee;
pub use core_types::base::Coin;
}

/// Fee includes the amount of coins paid in fees and the maximum
Expand Down
4 changes: 2 additions & 2 deletions gears/src/types/auth/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::{num::ParseIntError, str::FromStr};
use ux::u63;

pub mod inner {
pub use core_types::auth::fee::Fee;
pub use core_types::base::coin::Coin;
pub use core_types::auth::Fee;
pub use core_types::base::Coin;
}

/// Gas represents gas amounts. It's a wrapper around u63. Gas amounts are represented as i64 in tendermint
Expand Down
2 changes: 1 addition & 1 deletion gears/src/types/auth/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use super::{
};

pub mod inner {
pub use core_types::auth::info::AuthInfo;
pub use core_types::auth::AuthInfo;
}

/// AuthInfo describes the fee and signer modes that are used to sign a
Expand Down
4 changes: 2 additions & 2 deletions gears/src/types/auth/tip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use crate::types::{
};

mod inner {
pub use core_types::auth::tip::Tip;
pub use core_types::base::coin::Coin;
pub use core_types::auth::Tip;
pub use core_types::base::Coin;
}

// Tip is the tip used for meta-transactions.
Expand Down
4 changes: 2 additions & 2 deletions gears/src/types/base/coin/unsigned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use crate::types::{base::errors::CoinError, denom::Denom, errors::DenomError};
use super::Coin;

pub mod inner {
pub use core_types::base::coin::Coin;
pub use core_types::base::coin::IntProto;
pub use core_types::base::Coin;
pub use core_types::base::IntProto;
}

/// Coin defines a token with a denomination and an amount.
Expand Down
2 changes: 1 addition & 1 deletion gears/src/types/msg/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::types::{
};

mod inner {
pub use core_types::base::coin::Coin;
pub use core_types::base::Coin;
pub use core_types::msg::MsgSend;
}

Expand Down

0 comments on commit aa344f9

Please sign in to comment.