Skip to content

Commit 5d08af9

Browse files
committed
fixes
1 parent 180835b commit 5d08af9

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

substrate/frame/revive/rpc/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ sc-rpc = { workspace = true, default-features = true }
5959
sc-rpc-api = { workspace = true, default-features = true }
6060
sc-service = { workspace = true, default-features = true }
6161
sp-core = { workspace = true, default-features = true }
62+
sp-arithmetic = { workspace = true, default-features = true }
6263
sp-crypto-hashing = { workspace = true }
6364
sp-weights = { workspace = true, default-features = true }
6465
sqlx = { version = "0.8.2", features = [

substrate/frame/revive/rpc/src/lib.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use jsonrpsee::{
2424
types::{ErrorCode, ErrorObjectOwned},
2525
};
2626
use pallet_revive::evm::*;
27+
use sp_arithmetic::Permill;
2728
use sp_core::{keccak_256, H160, H256, U256};
2829
use thiserror::Error;
2930

@@ -127,7 +128,12 @@ impl EthRpcServer for EthRpcServerImpl {
127128
transaction_hash: H256,
128129
) -> RpcResult<Option<ReceiptInfo>> {
129130
let receipt = self.client.receipt(&transaction_hash).await;
130-
log::debug!(target: LOG_TARGET, "transaction_receipt for {transaction_hash:?}: {}", receipt.is_some());
131+
log::debug!(
132+
target: LOG_TARGET,
133+
"transaction_receipt for {transaction_hash:?}: received: {received} - success: {success:?}",
134+
received = receipt.is_some(),
135+
success = receipt.as_ref().map(|r| r.status == Some(U256::one()))
136+
);
131137
Ok(receipt)
132138
}
133139

@@ -226,6 +232,11 @@ impl EthRpcServer for EthRpcServerImpl {
226232
Ok(U256::from(GAS_PRICE))
227233
}
228234

235+
async fn max_priority_fee_per_gas(&self) -> RpcResult<U256> {
236+
// TODO: Provide better estimation
237+
Ok(U256::from(Permill::from_percent(20).mul_ceil(GAS_PRICE)))
238+
}
239+
229240
async fn get_code(&self, address: H160, block: BlockNumberOrTagOrHash) -> RpcResult<Bytes> {
230241
let code = self.client.get_contract_code(&address, block).await?;
231242
Ok(code.into())

substrate/frame/revive/rpc/src/rpc_methods_gen.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ pub trait EthRpc {
142142
transaction_hash: H256,
143143
) -> RpcResult<Option<ReceiptInfo>>;
144144

145+
/// Returns the current maxPriorityFeePerGas per gas in wei.
146+
#[method(name = "eth_maxPriorityFeePerGas")]
147+
async fn max_priority_fee_per_gas(&self) -> RpcResult<U256>;
148+
145149
/// Submits a raw transaction. For EIP-4844 transactions, the raw form must be the network form.
146150
/// This means it includes the blobs, KZG commitments, and KZG proofs.
147151
#[method(name = "eth_sendRawTransaction")]

substrate/frame/revive/src/wasm/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,9 @@ where
193193
&HoldReason::CodeUploadDepositReserve.into(),
194194
&self.code_info.owner,
195195
deposit,
196-
) .map_err(|err| { log::debug!(target: LOG_TARGET, "failed to store code for owner: {:?}: {err:?}", self.code_info.owner);
197-
<Error<T>>::StorageDepositNotEnoughFunds
196+
) .map_err(|err| {
197+
log::debug!(target: LOG_TARGET, "failed to hold store code deposit {deposit:?} for owner: {:?}: {err:?}", self.code_info.owner);
198+
<Error<T>>::StorageDepositNotEnoughFunds
198199
})?;
199200
}
200201

0 commit comments

Comments
 (0)