Skip to content

Commit

Permalink
fix export web3 rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
shaorongqiang committed Nov 29, 2024
1 parent 5a63253 commit 404d6ed
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 37 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ members = [
"src/components/contracts/primitives/enterprise-web3",
"src/components/contracts/rpc",
]
resolver = "2"

[profile.dev]
incremental = false
Expand Down
3 changes: 1 addition & 2 deletions src/components/abciapp/src/api/query_server/query_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ pub async fn get_related_xfrs(

#[allow(missing_docs)]
#[allow(clippy::unnecessary_wraps)]

pub async fn get_circulating_supply(
data: web::Data<Arc<RwLock<QueryServer>>>,
) -> actix_web::Result<web::Json<BTreeMap<&'static str, f64>>, actix_web::error::Error> {
Expand Down Expand Up @@ -651,7 +650,7 @@ impl QueryApi {
});

for (host, port) in addrs.iter() {
hdr = hdr.bind(&format!("{host}:{port}")).c(d!())?
hdr = hdr.bind(format!("{host}:{port}")).c(d!())?
}

hdr.run();
Expand Down
5 changes: 2 additions & 3 deletions src/components/contracts/modules/ethereum/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ impl<C: Config> App<C> {
let mut txn_signers = ctx.eth_cache.current.write();
match txn_signers.get(&transaction_hash) {
Some(signer) => *signer,
None => Self::recover_signer(transaction).map(|signer| {
txn_signers.insert(transaction_hash, Some(signer));
signer
None => Self::recover_signer(transaction).inspect(|signer| {
txn_signers.insert(transaction_hash, Some(*signer));
}),
}
}
Expand Down
10 changes: 3 additions & 7 deletions src/components/contracts/modules/evm/src/runtime/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct FindoraStackSubstate<'context, 'config> {
pub substate: Option<State<FinDB>>,
}

impl<'context, 'config> FindoraStackSubstate<'context, 'config> {
impl<'config> FindoraStackSubstate<'_, 'config> {
pub fn metadata(&self) -> &StackSubstateMetadata<'config> {
&self.metadata
}
Expand Down Expand Up @@ -207,9 +207,7 @@ impl<'context, 'vicinity, 'config, C: Config>
}
}

impl<'context, 'vicinity, 'config, C: Config> Backend
for FindoraStackState<'context, 'vicinity, 'config, C>
{
impl<C: Config> Backend for FindoraStackState<'_, '_, '_, C> {
fn gas_price(&self) -> U256 {
self.vicinity.gas_price
}
Expand Down Expand Up @@ -278,9 +276,7 @@ impl<'context, 'vicinity, 'config, C: Config> Backend
}
}

impl<'context, 'vicinity, 'config, C: Config> StackState<'config>
for FindoraStackState<'context, 'vicinity, 'config, C>
{
impl<'config, C: Config> StackState<'config> for FindoraStackState<'_, '_, 'config, C> {
fn metadata(&self) -> &StackSubstateMetadata<'config> {
self.substate.metadata()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl<'a> Deserialize<'a> for Bytes {

struct BytesVisitor;

impl<'a> Visitor<'a> for BytesVisitor {
impl Visitor<'_> for BytesVisitor {
type Value = Bytes;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<'a> Deserialize<'a> for Index {

struct IndexVisitor;

impl<'a> Visitor<'a> for IndexVisitor {
impl Visitor<'_> for IndexVisitor {
type Value = Index;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
12 changes: 6 additions & 6 deletions src/components/contracts/primitives/rpc-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ mod inner {
addr: &str,
io: RpcHandler<M>,
) -> io::Result<ipc::Server> {
let builder = ipc::ServerBuilder::new(io);
#[cfg(target_os = "unix")]
builder.set_security_attributes({
let mut builder = ipc::ServerBuilder::new(io);
#[cfg(target_family = "unix")]
{
let security_attributes = ipc::SecurityAttributes::empty();
security_attributes.set_mode(0o600)?;
security_attributes
});
builder =
builder.set_security_attributes(security_attributes.set_mode(0o600)?);
}
builder.start(addr)
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/contracts/rpc/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ impl EthApi for EthApiImpl {
cumulative_receipts
.truncate((status.transaction_index + 1) as usize);

return Ok(Some(Receipt {
Ok(Some(Receipt {
transaction_hash: Some(status.transaction_hash),
transaction_index: Some(status.transaction_index.into()),
block_hash: Some(block_hash),
Expand Down Expand Up @@ -1197,7 +1197,7 @@ impl EthApi for EthApiImpl {
status_code: Some(U64::from(receipt.state_root.to_low_u64_be())),
logs_bloom: receipt.logs_bloom,
state_root: None,
}));
}))
}
_ => Ok(None),
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/wallet_mobile/src/rust/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub enum EVMTransactionKind {
}

impl EVMTransactionBuilder {
/// transfer to uxto assets from account(ed25519 or ecdsa address) balance.
// transfer to uxto assets from account(ed25519 or ecdsa address) balance.

pub fn new_transfer_to_utxo_from_account(
recipient: XfrPublicKey,
Expand Down
16 changes: 8 additions & 8 deletions src/components/wallet_mobile/src/rust/data_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,20 +749,20 @@ impl TracingPolicy {
/// When an asset is defined, several options governing the assets must be
/// specified:
/// 1. **Traceable**: Records and identities of traceable assets can be decrypted by a provided tracing key. By defaults, assets do not have
/// any tracing policies.
/// any tracing policies.
/// 2. **Transferable**: Non-transferable assets can only be transferred once from the issuer to another user. By default, assets are transferable.
/// 3. **Updatable**: Whether the asset memo can be updated. By default, assets are not updatable.
/// 4. **Transfer signature rules**: Signature weights and threshold for a valid transfer. By
/// default, there are no special signature requirements.
/// 5. **Max units**: Optional limit on the total number of units of this asset that can be issued.
/// By default, assets do not have issuance caps.
/// @see {@link module:Findora-Wasm~TracingPolicies|TracingPolicies} for more information about tracing policies.
/// @see {@link module:Findora-Wasm~TransactionBuilder#add_operation_update_memo|add_operation_update_memo} for more information about how to add
/// a memo update operation to a transaction.
/// @see {@link module:Findora-Wasm~SignatureRules|SignatureRules} for more information about co-signatures.
/// @see {@link
/// module:Findora-Wasm~TransactionBuilder#add_operation_create_asset|add_operation_create_asset}
/// for information about how to add asset rules to an asset definition.
/// @see {@link module:Findora-Wasm~TracingPolicies|TracingPolicies} for more information about tracing policies.
/// @see {@link module:Findora-Wasm~TransactionBuilder#add_operation_update_memo|add_operation_update_memo} for more information about how to add
/// a memo update operation to a transaction.
/// @see {@link module:Findora-Wasm~SignatureRules|SignatureRules} for more information about co-signatures.
/// @see {@link
/// module:Findora-Wasm~TransactionBuilder#add_operation_create_asset|add_operation_create_asset}
/// for information about how to add asset rules to an asset definition.
pub struct AssetRules {
pub(crate) rules: PlatformAssetRules,
}
Expand Down
2 changes: 1 addition & 1 deletion src/ledger/src/data_model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl<'de> Deserialize<'de> for Code {
{
struct CodeVisitor;

impl<'de> Visitor<'de> for CodeVisitor {
impl Visitor<'_> for CodeVisitor {
type Value = Code;

#[inline(always)]
Expand Down
6 changes: 3 additions & 3 deletions src/ledger/src/staking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ lazy_static! {
};
}

/// The lock time after the delegation expires, about 21 days.
//pub const UNBOND_BLOCK_CNT: u64 = 3600 * 24 * 21 / BLOCK_INTERVAL;
// The lock time after the delegation expires, about 21 days.
// pub const UNBOND_BLOCK_CNT: u64 = 3600 * 24 * 21 / BLOCK_INTERVAL;

// minimal number of validators
/// Minimal number of validators
pub const VALIDATORS_MIN: usize = 5;

/// The minimum weight threshold required
Expand Down
3 changes: 1 addition & 2 deletions src/ledger/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,9 @@ impl LedgerState {
.check_txn_effects(&txe)
.c(d!())
.and_then(|_| block.add_txn_effect(txe).c(d!()))
.map(|tmpid| {
.inspect(|_| {
// NOTE: set at the last position
block.staking_simulator.coinbase_check_and_pay(&tx);
tmpid
})
}

Expand Down

0 comments on commit 404d6ed

Please sign in to comment.