Skip to content

Commit 69ec072

Browse files
add sent at timestamp in header when sending block to relays (flashbots#745)
## 📝 Summary Add sent at timestamp to block header when sending to relays, so that relays can benchmark sending timings ## 💡 Motivation and Context <!--- (Optional) Why is this change required? What problem does it solve? Remove this section if not applicable. --> --- ## ✅ I have completed the following steps: * [ ] Run `make lint` * [ ] Run `make test` * [ ] Added tests (if applicable)
1 parent 64a20db commit 69ec072

File tree

1 file changed

+18
-0
lines changed
  • crates/rbuilder/src/mev_boost

1 file changed

+18
-0
lines changed

crates/rbuilder/src/mev_boost/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,12 @@ impl RelayClient {
787787
bundle_ids.join(",")
788788
};
789789
builder = builder.header(BUNDLE_HASHES_HEADER, bundle_ids);
790+
791+
let sent_at = std::time::SystemTime::now()
792+
.duration_since(std::time::UNIX_EPOCH)
793+
.unwrap_or_default()
794+
.as_secs_f64();
795+
builder = builder.header("X-BuilderNet-SentAt", sent_at.to_string());
790796
}
791797
}
792798

@@ -830,6 +836,18 @@ impl RelayClient {
830836
"na".parse().map_err(|_| SubmitBlockErr::InvalidHeader)?,
831837
);
832838

839+
let sent_at = std::time::SystemTime::now()
840+
.duration_since(std::time::UNIX_EPOCH)
841+
.unwrap_or_default()
842+
.as_secs_f64();
843+
request.metadata_mut().insert(
844+
"x-buildernet-sentat",
845+
sent_at
846+
.to_string()
847+
.parse()
848+
.map_err(|_| SubmitBlockErr::InvalidHeader)?,
849+
);
850+
833851
let response = client.lock().await.submit_block(request).await?;
834852
Ok(response.into_inner())
835853
}

0 commit comments

Comments
 (0)