madara icon indicating copy to clipboard operation
madara copied to clipboard

dev: possibly changing storage architecture

Open chee-chyuan opened this issue 1 year ago • 1 comments

Not sure if storage architecture is the right term here. I'm seeing that to obtain the transaction receipt via get_transaction_receipt ,the logic of doing so is

 let find_receipt = block
            .transaction_receipts()
            .into_iter()
            .find(|receipt| receipt.transaction_hash == transaction_hash.into())
            .map(|receipt| {
                receipt
                    .clone()
                    .into_maybe_pending_transaction_receipt(TransactionStatus::AcceptedOnL2, (block_hash, block_number))
            });

looping through the receipts in the block O(n) and populating the output TxReceipt struct. This could work in the case where transaction per block is low but would possibly be expensive should a block has many transactions.

My simple proposal is to store in the db a tx_hash -> transaction body mapping. Of cos there are many things to consider. Trying to get the ball rolling at least

chee-chyuan avatar Jul 30 '23 04:07 chee-chyuan

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a 👍 Because this issue is marked as stale, it will be closed and locked in 7 days if no further activity occurs. Thank you for your contributions!

github-actions[bot] avatar Aug 30 '23 00:08 github-actions[bot]

repository archived in favor of https://github.com/madara-alliance/madara

tdelabro avatar Aug 02 '24 18:08 tdelabro