Skip to content

Commit 61b5d2c

Browse files
feat: use taikoAuth_lastCertainBlockIDByBatchID instead of taikoAuth_lastBlockIDByBatchID (#917)
* feat: use taikoAuth_lastCertainBlockIDByBatchID instead of taikoAuth_lastBlockIDByBatchID * bump version * Update shasta/src/l2/taiko.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d051a7f commit 61b5d2c

5 files changed

Lines changed: 25 additions & 17 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resolver = "2"
1313
default-members = ["node"]
1414

1515
[workspace.package]
16-
version = "1.34.10"
16+
version = "1.34.11"
1717
edition = "2024"
1818
repository = "https://github.com/NethermindEth/Catalyst"
1919
license = "MIT"

common/src/l2/engine.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,19 @@ impl L2Engine {
5656
Ok(Self { auth_rpc, config })
5757
}
5858

59-
pub async fn get_last_block_id_by_batch_id(&self, batch_id: u64) -> Result<Option<u64>, Error> {
59+
pub async fn get_last_certain_block_id_by_batch_id(
60+
&self,
61+
batch_id: u64,
62+
) -> Result<Option<u64>, Error> {
6063
let hex_batch_id = format!("0x{:x}", batch_id);
6164
let params = vec![Value::String(hex_batch_id)];
6265
let result = self
6366
.auth_rpc
64-
.call_method("taikoAuth_lastBlockIDByBatchID", params)
67+
.call_method("taikoAuth_lastCertainBlockIDByBatchID", params)
6568
.await
6669
.map_err(|e| {
6770
anyhow::anyhow!(
68-
"taikoAuth_lastBlockIDByBatchID failed: batch id {}: {}",
71+
"taikoAuth_lastCertainBlockIDByBatchID failed: batch id {}: {}",
6972
batch_id,
7073
e
7174
)

shasta/src/l2/taiko.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ impl Taiko {
157157
{
158158
let start = std::time::Instant::now();
159159
let safe_block_id = self
160-
.get_last_block_id_by_proposal_id(inbox_forced_inclusion_state.next_proposal_id - 1)
160+
.get_last_certain_block_id_by_proposal_id(
161+
inbox_forced_inclusion_state.next_proposal_id - 1,
162+
)
161163
.await?;
162164
let unsafe_block_id = self.get_latest_l2_block_id().await?;
163165
for block_id in safe_block_id + 1..=unsafe_block_id {
@@ -180,15 +182,18 @@ impl Taiko {
180182
Ok(fi_head)
181183
}
182184

183-
pub async fn get_last_block_id_by_proposal_id(&self, proposal_id: u64) -> Result<u64, Error> {
185+
pub async fn get_last_certain_block_id_by_proposal_id(
186+
&self,
187+
proposal_id: u64,
188+
) -> Result<u64, Error> {
184189
match self
185190
.l2_engine
186-
.get_last_block_id_by_batch_id(proposal_id)
191+
.get_last_certain_block_id_by_batch_id(proposal_id)
187192
.await?
188193
{
189194
Some(block_id) => Ok(block_id),
190195
None => Err(anyhow::anyhow!(
191-
"last block id by proposal id {} is None",
196+
"no last certain block id returned for proposal_id {} via get_last_certain_block_id_by_batch_id",
192197
proposal_id
193198
)),
194199
}

shasta/src/node/last_safe_l2_block_finder/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl LastSafeL2BlockFinder {
102102
// Fast path: try direct lookup via Taiko
103103
match self
104104
.taiko
105-
.get_last_block_id_by_proposal_id(target_proposal_id)
105+
.get_last_certain_block_id_by_proposal_id(target_proposal_id)
106106
.await
107107
{
108108
Ok(block_id) => {
@@ -113,7 +113,7 @@ impl LastSafeL2BlockFinder {
113113
}
114114
Err(err) => {
115115
tracing::warn!(
116-
"LastSafeL2BlockFinder::find_last_block_for_proposal_id(): Failed to get last block id by proposal id: {}",
116+
"LastSafeL2BlockFinder::find_last_block_for_proposal_id(): Failed to get last certain block id by proposal id: {}",
117117
err
118118
);
119119
}

0 commit comments

Comments
 (0)