Skip to content

Commit c9b64a1

Browse files
committed
fix: updating bytecode linking
1 parent d8e2725 commit c9b64a1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/slashing_registry_coordinator.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,22 @@ fn link_all_fully_qualified(
5959
if let (Some(start), Some(length)) =
6060
(position["start"].as_u64(), position["length"].as_u64())
6161
{
62+
// 1 bytes = 2 characters. then convert to usize
63+
let char_length = (length * 2) as usize;
6264
// Convert address to hex string and prepare replacement
6365
let addr_hex = format!("{:x}", lib_address);
6466
let addr_hex = addr_hex.strip_prefix("0x").unwrap_or(&addr_hex);
6567

6668
// Pad with zeros or trim to match required length
67-
let replacement = if addr_hex.len() < length as usize {
68-
format!("{:0>width$}", addr_hex, width = length as usize)
69+
let replacement = if addr_hex.len() < char_length {
70+
format!("{:0>width$}", addr_hex, width = char_length)
6971
} else {
70-
addr_hex[..length as usize].to_string()
72+
addr_hex[..char_length].to_string()
7173
};
7274

7375
replacements.push((
74-
start as usize * 2,
75-
length as usize * 2,
76+
((start + 1) * 2) as usize,
77+
char_length,
7678
replacement,
7779
));
7880
}
@@ -173,6 +175,7 @@ pub async fn deploy<P: alloy_contract::private::Provider<N> + Clone, N: Network>
173175
_version,
174176
)
175177
.await?;
178+
println!("builder: {:?}", builder);
176179
let deployed = builder.deploy().await?;
177180

178181
// ContractNotDeployed

0 commit comments

Comments
 (0)