Skip to content

Commit 1b2a676

Browse files
authored
Merge branch 'main' into add-claude-github-actions-1754123263062
2 parents 2705dde + 361a622 commit 1b2a676

7 files changed

Lines changed: 15 additions & 24 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ alloy-rpc-types-engine = { version = "1.0.23", default-features = false }
9595
alloy-signer-local = { version = "1.0.23", features = ["mnemonic"] }
9696
alloy-primitives = { version = "1.2.0", default-features = false }
9797
alloy-consensus = { version = "1.0.23", default-features = false }
98-
alloy-rlp = { version = "0.3", default-features = false }
9998
alloy-genesis = { version = "1.0.23", default-features = false }
10099
alloy-rpc-types-txpool = { version = "1.0.23", default-features = false }
101100

crates/evolve/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ alloy-rpc-types-engine.workspace = true
2929
alloy-primitives.workspace = true
3030
alloy-eips.workspace = true
3131
alloy-consensus.workspace = true
32-
alloy-rlp.workspace = true
3332
alloy-rpc-types-txpool.workspace = true
3433

3534
# Core dependencies

crates/evolve/src/rpc/txpool.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use alloy_primitives::Bytes;
2-
use alloy_rlp::Encodable;
32
use async_trait::async_trait;
43
use jsonrpsee_core::RpcResult;
54
use jsonrpsee_proc_macros::rpc;
6-
use reth_transaction_pool::{TransactionPool, ValidPoolTransaction};
5+
use reth_transaction_pool::{PoolTransaction, TransactionPool};
76

87
/// Rollkit txpool RPC API trait
98
#[rpc(server, namespace = "txpoolExt")]
@@ -48,31 +47,30 @@ where
4847
/// Returns a Geth-style `TxpoolContent` with raw RLP hex strings.
4948
async fn get_txs(&self) -> RpcResult<Vec<Bytes>> {
5049
//------------------------------------------------------------------//
51-
// 1. Iterate pending txs and stop once we hit the byte cap //
50+
// 1. Iterate best txs (sorted by priority) and stop once we hit //
51+
// the byte cap //
5252
//------------------------------------------------------------------//
5353
let mut total = 0u64;
54-
let mut pending_map: Vec<Bytes> = Vec::new();
54+
let mut selected_txs: Vec<Bytes> = Vec::new();
5555

56-
for arc_tx in self.pool.pending_transactions() {
57-
// deref Arc<ValidPoolTransaction<_>>
58-
let pooled: &ValidPoolTransaction<_> = &arc_tx;
59-
60-
let sz = pooled.encoded_length() as u64;
56+
// Use best_transactions() which returns an iterator of transactions
57+
// ordered by their priority (gas price/priority fee)
58+
for best_tx in self.pool.best_transactions() {
59+
let sz = best_tx.encoded_length() as u64;
6160
if total + sz > self.max_bytes {
6261
break;
6362
}
6463

65-
// inside the loop
66-
let tx = pooled.to_consensus();
67-
let mut rlp_bytes = Vec::new();
68-
tx.encode(&mut rlp_bytes);
64+
// Convert to consensus transaction and encode to RLP
65+
let tx = best_tx.transaction.clone().into_consensus_with2718();
66+
let bz = tx.encoded_bytes();
6967

70-
pending_map.push(Bytes::from(rlp_bytes));
68+
selected_txs.push(bz.clone());
7169

7270
total += sz;
7371
}
7472

75-
Ok(pending_map)
73+
Ok(selected_txs)
7674
}
7775
}
7876

crates/node/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ alloy-rpc-types-engine.workspace = true
4848
alloy-primitives.workspace = true
4949
alloy-eips.workspace = true
5050
alloy-consensus.workspace = true
51-
alloy-rlp.workspace = true
5251

5352
# Core dependencies
5453
eyre.workspace = true

crates/tests/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ alloy-rpc-types-engine.workspace = true
4848
alloy-primitives.workspace = true
4949
alloy-eips.workspace = true
5050
alloy-consensus.workspace = true
51-
alloy-rlp.workspace = true
5251

5352
# Core dependencies
5453
tempfile.workspace = true

crates/tests/src/test_rollkit_engine_api.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
99
use crate::common;
1010

11+
use alloy_eips::eip2718::Encodable2718;
1112
use alloy_primitives::{Address, Bytes, B256};
12-
use alloy_rlp::Encodable;
1313
use alloy_rpc_types::engine::{ForkchoiceState, PayloadId};
1414
use eyre::Result;
1515
use reth_primitives::TransactionSigned;
@@ -190,7 +190,7 @@ impl EngineApiTestNode {
190190
/// Encodes a transaction to bytes for Engine API
191191
fn encode_transaction(tx: &TransactionSigned) -> Result<Bytes> {
192192
let mut buf = Vec::new();
193-
tx.encode(&mut buf);
193+
tx.encode_2718(&mut buf);
194194
Ok(Bytes::from(buf))
195195
}
196196

0 commit comments

Comments
 (0)