Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion synd-mchain/src/methods/eth_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ use std::{
time::UNIX_EPOCH,
};

/// hardfork timestamp
pub const HARDFORK_TS: u64 = 1764565200;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably name this a bit more explicitly like: L1_BLOCK_NUM_HARDFORK_TS


/// `eth_subscribe`
#[allow(clippy::unwrap_used)]
pub async fn eth_subscribe(
Expand Down Expand Up @@ -190,8 +193,13 @@ pub fn eth_get_block_by_hash(
let (hash, _): (FixedBytes<32>, bool) = p.parse()?;
let number = u64::from_be_bytes(hash[hash.len() - 8..].try_into().map_err(to_err)?);
let block = db.get_block(number)?;
let l1_block_number = if block.timestamp < HARDFORK_TS {
block.slot.seq_block_number
} else {
block.slot.set_block_number
};
Ok(alloy::rpc::types::Block {
header: create_header(number, block.slot.seq_block_number, block.timestamp),
header: create_header(number, l1_block_number, block.timestamp),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is different in main, now we pass the entire block to create_header

btw, I think we also need to update the l1_block_num logic here:

..Default::default()
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use contract_bindings::synd::i_bridge::IBridge::MessageDelivered;
use eyre::Result;
use shared::types::{BlockBuilder, DelayedMsgsData, PartialBlock};
use std::collections::HashMap;
use synd_mchain::db::DelayedMessage;
use synd_mchain::{db::DelayedMessage, methods::eth_methods::HARDFORK_TS};
use thiserror::Error;
use tracing::{debug, error, info, trace};

Expand Down Expand Up @@ -143,11 +143,14 @@ impl ArbitrumAdapter {
.map(|x|x.1).collect::<Vec<_>>()
);

let block_number =
if block.block_ref.timestamp < HARDFORK_TS { block.block_ref.timestamp } else { 0 };

Ok((
mb_transactions.len() as u64,
self.build_batch_txn(
mb_transactions.into_iter().map(|x| x.0).collect(),
block.block_ref.number,
block_number,
block.block_ref.timestamp,
)?,
))
Expand Down
3 changes: 2 additions & 1 deletion synd-withdrawals/synd-enclave/enclave/accumulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func buildL2MessageSegment(txs [][]byte) ([]byte, error) {
}

const TX_PER_BLOCK = 100
const HARDFORK_TS = 1764565200

func buildBatch(txs [][]byte, ts uint64, blockNum uint64) ([]byte, error) {
var data []byte
Expand All @@ -114,7 +115,7 @@ func buildBatch(txs [][]byte, ts uint64, blockNum uint64) ([]byte, error) {
data = append(data, segment...)
}

if blockNum != 0 {
if blockNum != 0 && ts < HARDFORK_TS {
segment, err := rlp.EncodeToBytes(blockNum)
if err != nil {
return nil, err
Expand Down
3 changes: 3 additions & 0 deletions synd-withdrawals/synd-enclave/enclave/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,9 @@ func processMessage(msg []byte, blockNum uint64, ts uint64) ([]byte, error) {
if _, ok := allowedMsgs[msg[0]]; !ok {
return nil, fmt.Errorf("unexpected message: type %d", msg[0])
}
if ts >= HARDFORK_TS {
blockNum = binary.BigEndian.Uint64(msg[33:41])
}
if msg[0] == arbostypes.L1MessageType_BatchPostingReport {
requestId := msg[teetypes.DelayedMessageRequestIdOffset : teetypes.DelayedMessageRequestIdOffset+32]
msg = make([]byte, teetypes.DelayedMessageDataOffset)
Expand Down
Loading