Skip to content
Merged
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,10 @@ FOLLOWER_NODE_HOST?=http://localhost
BLOCK_NUMBER?=$(shell echo $$(( $$(cast block-number --rpc-url http://localhost:$(BOP_EL_PORT)) + 1 )))
DUMMY_RICH_WALLET_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
DUMMY_TX=$(shell cast mktx --rpc-url $(FOLLOWER_NODE_HOST):$(BOP_EL_PORT) --private-key $(DUMMY_RICH_WALLET_PRIVATE_KEY) --value 1 0x7DDcC7c49D562997A68C98ae7Bb62eD1E8E4488a | xxd -r -p | base64)
PORTAL_PORT?=8080
LOCAL_GETH_PORT?=8645

test-tx:
cast send --rpc-url http://127.0.0.1:$(PORTAL_PORT) --private-key $(DUMMY_RICH_WALLET_PRIVATE_KEY) --value 1 0x7DDcC7c49D562997A68C98ae7Bb62eD1E8E4488a
cast send --rpc-url http://0.0.0.0:$(LOCAL_GETH_PORT) --private-key $(DUMMY_RICH_WALLET_PRIVATE_KEY) --value 1 0x7DDcC7c49D562997A68C98ae7Bb62eD1E8E4488a

test-frag:
curl --request POST --url $(FOLLOWER_NODE_HOST):$(BOP_NODE_PORT) --header 'Content-Type: application/json' \
Expand Down
1 change: 1 addition & 0 deletions based/bin/overseer/src/data/frag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ impl FragData {

pub fn to_block_table_row(&self) -> Vec<Text<'_>> {
let Frag::SorterStart { seq, .. } = &self.updates[0].1 else {
tracing::warn!("strange frag setup");
return vec![];
};
let (payment, gas_used, n_txs) = self.frag_stats().unwrap_or_default();
Expand Down
4 changes: 2 additions & 2 deletions based/crates/common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ pub struct GatewayArgs {
#[arg(long = "eth_client.url", default_value = "http://localhost:8545")]
pub eth_client_url: Url,
/// Url to the root peer gossip node
#[arg(long = "gossip.root_peer_url")]
pub gossip_root_peer_url: Option<Url>,
#[arg(long = "gossip.root_peer_url", default_value = "http://localhost:8547")]
pub gossip_root_peer_url: Url,
/// Gossip to sign frag messages
#[arg(long = "gossip.signer_private_key")]
pub gossip_signer_private_key: Option<B256>,
Expand Down
17 changes: 6 additions & 11 deletions based/crates/pool/src/transaction/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct TxPool {
/// maps an eoa to all pending txs
pool_data: HashMap<Address, TxList>,
/// Current list of all simulated mineable txs in the pool
active_txs: Active,
pub active_txs: Active,
}

impl TxPool {
Expand All @@ -39,12 +39,12 @@ impl TxPool {
base_fee: u64,
syncing: bool,
sim_sender: Option<&SendersSpine<Db>>,
) {
) -> bool {
let state_nonce = db.get_nonce(new_tx.sender()).expect("handle failed db");
let nonce = new_tx.nonce();
// check nonce is valid
if nonce < state_nonce {
return;
return false;
}

let is_next_nonce = nonce == state_nonce;
Expand All @@ -57,7 +57,7 @@ impl TxPool {
// above where we didn't return
if tx_list.get_effective_price_for_nonce(&nonce, base_fee) > new_tx.effective_gas_price(Some(base_fee))
{
return;
return false;
}
tx_list.put(new_tx.clone());

Expand Down Expand Up @@ -92,6 +92,7 @@ impl TxPool {
self.pool_data.insert(tx_list.sender(), tx_list);
}
}
true
}

/// Validates simualted tx. If valid, fetch its TxList and save the new [SimulatedTxList] to `active_txs`.
Expand Down Expand Up @@ -152,19 +153,13 @@ impl TxPool {
/// This gets called in two places:
/// 1) When we sync a new block.
/// 2) When we commit a new Frag.
pub fn handle_new_block<'a, Db: DatabaseRead, T: TransactionSenderInfo + 'a>(
pub fn handle_new_block<Db: DatabaseRead>(
&mut self,
mined_txs: impl Iterator<Item = &'a T>,
base_fee: u64,
db: &DBFrag<Db>,
syncing: bool,
sim_sender: Option<&SendersSpine<Db>>,
telemetry_producer: &mut Producer<TelemetryUpdate>,
) {
// Completely wipe active txs as they may contain valid nonces with out of date sim results.
self.active_txs.clear();
self.remove_mined_txs(mined_txs, telemetry_producer);

// If enabled, fill the active list with non-simulated txs and send off the first tx for each sender to
// simulator.
if !syncing {
Expand Down
10 changes: 3 additions & 7 deletions based/crates/rpc/src/gossiper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ use reqwest::blocking::{Client, ClientBuilder};
use tracing::{error, info};

pub struct Gossiper {
target_rpc: Option<Url>,
target_rpc: Url,
client: Client,
signer: ECDSASigner,
}

impl Gossiper {
pub fn new(target_rpc: Option<Url>, signer: Option<ECDSASigner>) -> Self {
pub fn new(target_rpc: Url, signer: Option<ECDSASigner>) -> Self {
let client = ClientBuilder::new()
.timeout(std::time::Duration::from_secs(10))
.build()
Expand All @@ -22,13 +22,9 @@ impl Gossiper {
}

fn gossip(&self, msg: p2p::VersionedMessage) {
let Some(url) = self.target_rpc.as_ref().cloned() else {
return;
};

let payload = msg.to_json(&self.signer);

let Ok(res) = self.client.post(url).json(&payload).send() else {
let Ok(res) = self.client.post(self.target_rpc.clone()).json(&payload).send() else {
tracing::error!("couldn't send {}", payload);
return;
};
Expand Down
20 changes: 9 additions & 11 deletions based/crates/sequencer/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,15 @@ impl<Db: DatabaseRead + Database<Error: Into<ProviderError> + Display>> Sequence
self.deposits.push_back(tx);
return;
}
TelemetryUpdate::send(tx.uuid, tx.to_added_to_pool_telemetry(), &mut self.telemetry);
self.tx_pool.handle_new_tx(
if self.tx_pool.handle_new_tx(
tx.clone(),
self.shared_state.as_ref(),
self.as_ref().basefee.to(),
false,
self.config.simulate_tof_in_pools.then_some(senders),
);
) {
TelemetryUpdate::send(tx.uuid, tx.to_added_to_pool_telemetry(), &mut self.telemetry);
}
}

/// Processes a new block from the sequencer by:
Expand Down Expand Up @@ -337,17 +338,14 @@ impl<Db: DatabaseWrite + DatabaseRead> SequencerContext<Db> {
self.parent_header = block.header.clone();
self.parent_hash = block.hash_slow();

// Completely wipe active txs as they may contain valid nonces with out of date sim results.
self.tx_pool.active_txs.clear();
self.tx_pool.remove_mined_txs(block.body.transactions.iter(), &mut self.telemetry);

if let Some(base_fee) = block.base_fee_per_gas {
self.base_fee = base_fee;

self.tx_pool.handle_new_block(
block.body.transactions.iter(),
base_fee,
self.shared_state.as_ref(),
false,
None,
&mut self.telemetry,
);
self.tx_pool.handle_new_block(base_fee, self.shared_state.as_ref(), false, None);
}

blocks_to_fetch
Expand Down
2 changes: 1 addition & 1 deletion based/crates/sequencer/src/sorting/sorting_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<Db> SortingData<Db> {
txs: vec![],
start_t: Instant::now(),
telemetry: Default::default(),
uuid: Uuid::new_v4(),
uuid,
telemetry_producer,
}
}
Expand Down
1 change: 1 addition & 0 deletions follower_node/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ services:
- --rpc.enable-based
- --registry=$PORTAL
- --p2p.bootnodes=$MAIN_OP_NODE_ENR
- --syncmode=execution-layer
volumes:
- ./data/node:/data/op-node
- ./config:/config
Expand Down
23 changes: 13 additions & 10 deletions optimism/op-node/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,19 @@ func (n *OpNode) initRegistry(ctx context.Context, cfg *Config) error {
return fmt.Errorf("failed to fetch initial gateways: %w", err)
}

// Start fetching future gateways
go func() {
for {
fetchCtx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()

if err := n.registrySource.FetchNextNGateways(fetchCtx, 2, 3); err != nil {
n.log.Warn("registry fetch error", "err", err)
}
time.Sleep(time.Second)
}
}()

return nil
}

Expand Down Expand Up @@ -765,16 +778,6 @@ func (n *OpNode) OnSealFrag(ctx context.Context, from peer.ID, seal *eth.SignedS
n.log.Info("Received new seal", "seal", seal)
n.preconfChannels.SendSeal(seal)

// Start fetching future gateways
go func() {
fetchCtx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()

if err := n.registrySource.FetchNextNGateways(fetchCtx, 2, 3); err != nil {
n.log.Warn("registry fetch error", "err", err)
}
}()

return nil
}

Expand Down
3 changes: 2 additions & 1 deletion optimism/op-node/rollup/engine/engine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ func (e *EngineController) BackupUnsafeL2Head() eth.L2BlockRef {
}

func (e *EngineController) IsEngineSyncing() bool {
return e.syncStatus == syncStatusWillStartEL || e.syncStatus == syncStatusStartedEL || e.syncStatus == syncStatusFinishedELButNotFinalized
// return e.syncStatus == syncStatusWillStartEL || e.syncStatus == syncStatusStartedEL || e.syncStatus == syncStatusFinishedELButNotFinalized
return true
}

// Setters
Expand Down
Loading