Skip to content

Conversation

@daniilrrr
Copy link
Collaborator

@daniilrrr daniilrrr commented Oct 24, 2024

Ticket

  • Related Linear Ticket: SEQ-161

What does this PR do?

  • Summary: This PR introduces compression for bulk transaction submission using zlib, which matches op-node's internal implementation.
  • Key Changes:
    • Added zlib support for de/compression of txn/s
    • Introduced process_bulk_transactions_compressed to compress input
      • Compression will only be used by bulk transaction endpoints, which we won't have as part of private testnet.

Does this PR introduce any breaking changes (API/schema)?

  • No
  • It depends on the existence of a new function in the contract in the form of
    function processBulkTransactionsCompressed(bytes calldata compressedTxns) public;

Do any environment variables need to be updated or added before deployment?

  • No

How can this PR be tested?

  • Unit tests pass
  • (?) Dev container invocations pass (TBC)

@linear
Copy link

linear bot commented Oct 24, 2024

SEQ-161 Compress incoming transactions using zlib compression

op-translator assumes that the transactions will be gzip-compressed, so we should handle that here too

AC

  • any transaction submitted to the sequencer has its TransactionList Brotli-compressed
  • TBC

@daniilrrr daniilrrr force-pushed the daniil/SEQ-161-brotli-for-txn-list branch 2 times, most recently from 458aafc to b180601 Compare October 24, 2024 19:09
@daniilrrr daniilrrr marked this pull request as ready for review October 24, 2024 19:11
@daniilrrr daniilrrr requested a review from WillPapper October 24, 2024 19:16

async fn process_bulk_transactions_compressed(&self, tx: Vec<Bytes>) -> Result<(), Self::Error> {
// Note: Compression starts being beneficial at ~5 transactions
let compressed_txs = compress_transactions(&tx)?;
Copy link
Contributor

@RomanHodulak RomanHodulak Oct 24, 2024

Choose a reason for hiding this comment

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

I wouldn't do this here, because the Chain should just pass in whatever bytes it gets, it should not be reponsible for doing the compression - it already is responsible for writing into the smart contract.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok that makes sense, we should do it at the endpoint level.

currently we only have the send_raw_transaction endpoint which maps -> process_transaction contract call.

We have no endpoint to map to the process_bulk_transactions or process_bulk_transactions_compressed, which makes sense because those will only become relevant once we have load balancing and Mempooler, which will be after private testnet

Copy link
Collaborator Author

@daniilrrr daniilrrr Oct 25, 2024

Choose a reason for hiding this comment

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

Created SEQ-248 to track this throughout PR. I don't like pushing commented code but I think here it's the best thing to do, since we will work on bulk txns relatively soon

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice job

@daniilrrr daniilrrr force-pushed the daniil/SEQ-161-brotli-for-txn-list branch from b5f6357 to 4ad869d Compare October 25, 2024 21:21
@daniilrrr daniilrrr force-pushed the daniil/SEQ-161-brotli-for-txn-list branch from 4ad869d to 2748e6a Compare October 25, 2024 21:21
@daniilrrr daniilrrr merged commit 9f1204c into main Oct 28, 2024
2 checks passed
@daniilrrr daniilrrr deleted the daniil/SEQ-161-brotli-for-txn-list branch October 28, 2024 15:52
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.

3 participants