Skip to content

Commit 3144934

Browse files
committed
add warn
1 parent b980145 commit 3144934

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

crates/ingress-rpc/src/service.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ where
8181
{
8282
async fn send_bundle(&self, bundle: Bundle) -> RpcResult<BundleHash> {
8383
self.validate_bundle(&bundle).await?;
84-
let meter_bundle_response = self.meter_bundle(&bundle).await?;
8584
let parsed_bundle: ParsedBundle = bundle
85+
.clone()
8686
.try_into()
8787
.map_err(|e: String| EthApiError::InvalidParams(e).into_rpc_err())?;
88+
let bundle_hash = &parsed_bundle.bundle_hash();
89+
let meter_bundle_response = self.meter_bundle(&bundle, bundle_hash).await?;
8890
let accepted_bundle = AcceptedBundle::new(parsed_bundle, meter_bundle_response);
8991

90-
let bundle_hash = &accepted_bundle.bundle_hash();
9192
if let Err(e) = self
9293
.bundle_queue
9394
.publish(&accepted_bundle, bundle_hash)
@@ -139,13 +140,17 @@ where
139140
reverting_tx_hashes: vec![transaction.tx_hash()],
140141
..Default::default()
141142
};
142-
let meter_bundle_response = self.meter_bundle(&bundle).await?;
143-
144143
let parsed_bundle: ParsedBundle = bundle
144+
.clone()
145145
.try_into()
146146
.map_err(|e: String| EthApiError::InvalidParams(e).into_rpc_err())?;
147+
148+
let bundle_hash = &parsed_bundle.bundle_hash();
149+
let meter_bundle_response = self
150+
.meter_bundle(&bundle, bundle_hash)
151+
.await?;
152+
147153
let accepted_bundle = AcceptedBundle::new(parsed_bundle, meter_bundle_response);
148-
let bundle_hash = &accepted_bundle.bundle_hash();
149154

150155
if let Err(e) = self
151156
.bundle_queue
@@ -250,7 +255,11 @@ where
250255
/// `meter_bundle` is used to determine how long a bundle will take to execute. A bundle that
251256
/// is within `block_time_milliseconds` will return the `MeterBundleResponse` that can be passed along
252257
/// to the builder.
253-
async fn meter_bundle(&self, bundle: &Bundle) -> RpcResult<MeterBundleResponse> {
258+
async fn meter_bundle(
259+
&self,
260+
bundle: &Bundle,
261+
bundle_hash: &B256,
262+
) -> RpcResult<MeterBundleResponse> {
254263
let start = Instant::now();
255264
let timeout_duration = Duration::from_millis(self.meter_bundle_timeout_ms);
256265

@@ -267,6 +276,7 @@ where
267276
)
268277
.await
269278
.map_err(|_| {
279+
warn!(message = "Timed out on requesting metering", bundle_hash = %bundle_hash);
270280
EthApiError::InvalidParams("Timeout on requesting metering".into()).into_rpc_err()
271281
})?
272282
.map_err(|e| EthApiError::InvalidParams(e.to_string()).into_rpc_err())?;

0 commit comments

Comments
 (0)