Skip to content

Commit 2d51778

Browse files
authored
Better logging for contract deployment (#46)
* Log certain errors better * Remove unneeded code
1 parent baa11ad commit 2d51778

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

crates/core/src/driver/mod.rs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,17 @@ where
219219
continue;
220220
};
221221

222-
let nonce = node.fetch_add_nonce(input.caller)?;
222+
let nonce = match node.fetch_add_nonce(input.caller) {
223+
Ok(nonce) => nonce,
224+
Err(error) => {
225+
tracing::error!(
226+
caller = ?input.caller,
227+
?error,
228+
"Failed to get the nonce for the caller"
229+
);
230+
return Err(error);
231+
}
232+
};
223233

224234
tracing::debug!(
225235
"Calculated nonce {}, for contract {}, having address {} on node: {}",
@@ -232,7 +242,17 @@ where
232242
// We are using alloy for building and submitting the transactions and it will
233243
// automatically fill in all of the missing fields from the provider that we
234244
// are using.
235-
let code = alloy::hex::decode(&code)?;
245+
let code = match alloy::hex::decode(&code) {
246+
Ok(code) => code,
247+
Err(error) => {
248+
tracing::error!(
249+
code,
250+
?error,
251+
"Failed to hex-decode the code of the contract. (This could possibly mean that it contains '_' and therefore it requires linking to be performed)"
252+
);
253+
return Err(error.into());
254+
}
255+
};
236256
let tx = TransactionRequest::default()
237257
.nonce(nonce)
238258
.from(input.caller)

0 commit comments

Comments
 (0)