Skip to content

Conversation

ferranbt
Copy link
Contributor

πŸ“ Summary

Closes #46

πŸ’‘ Motivation and Context


βœ… I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

@ferranbt ferranbt marked this pull request as ready for review May 28, 2025 11:16
let da_config = builder_config.da_config.clone();
let rollup_args = builder_args.rollup_args;
let op_node = OpNode::new(rollup_args.clone());
let reverted_cache = create_shared_cache(100);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am open minded to do this in a different way. I have another PR to modify the transaction pool monitor so I think this could get cleaner once that lands and there is a concrete TxPoolMonitor structure.

Comment on lines 72 to 80
pub type SharedLruCache<K, V> = Arc<Mutex<LruCache<K, V>>>;

pub fn create_shared_cache<K, V>(capacity: usize) -> SharedLruCache<K, V>
where
K: std::hash::Hash + Eq,
{
let cache = LruCache::new(NonZeroUsize::new(capacity).unwrap());
Arc::new(Mutex::new(cache))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest using Moka instead of this because if we use Arc-Mutex we will be only serving one RPC call at a time and won't have scalable/concurrent RPC API.

Some(receipt) => Ok(Some(receipt)),
None => {
// Try to find the transaction in the reverted cache
let reverted_cache = self.reverted_cache.lock().unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think ideally we want to use some kind of lock that would prioritize writers
also with sync mutex you could rect the runtime

Copy link
Contributor

Choose a reason for hiding this comment

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

DashSet is also a descent option.


if let Some(revert_protection) = self.with_revert_protection {
if revert_protection {
println!("revert_protection is enabled");
Copy link
Collaborator

Choose a reason for hiding this comment

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

debug

@ferranbt ferranbt merged commit d5e89ff into main May 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return an error in eth_getTransactionReceipt if a transaction was discarded

3 participants