Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementing mempool and remove 1 tx per tick limitation #226

Open
Franziska-Mueller opened this issue Nov 28, 2024 · 1 comment
Open

implementing mempool and remove 1 tx per tick limitation #226

Franziska-Mueller opened this issue Nov 28, 2024 · 1 comment
Assignees

Comments

@Franziska-Mueller
Copy link
Collaborator

Franziska-Mueller commented Nov 28, 2024

Currently, qubic protocol has these limitation about transactions & mempool:

  • One address (ID) can only have 1 transaction(tx) per tick. Eg: if you submit 2 transactions to tick N: A sends QUs to B and A sends QUs to C, only one of them will be included (picked by tick leader).
  • One address (ID) can only have 1 transaction(tx) in the mempool. Eg: if you submit 2 transactions update #1 A sends QUs to B at tick N and Update efi-build-develop.yml #2 A sends QUs to C at tick (N+1). Tx Update efi-build-develop.yml #2 will replace update #1 because it has higher scheduled tick.
  • Recently we allow computor ID to have 128 txs per tick (they have their own mempool):
    Image

We now want to remove above limitation and allow all IDs to have many txs per tick. (thus many txs in the mempool)

Structure of Transaction (in network_messages/transaction.h):

struct Transaction
{
    m256i sourcePublicKey;
    m256i destinationPublicKey;
    long long amount;
    unsigned int tick; // <~ scheduled tick
    unsigned short inputType;
    unsigned short inputSize;
}

A mempool should be able to do these 3 basic functions (just suggestion, you can improve while doing this):

void update(Transaction* tx, enum strategy):

  • check valid and add tx to the pool. It maybe unnecessary to add a tx that has scheduled_tick = current_tick + 2000
  • To avoid spamming to the pool, we need a strategy (to add/remove which tx) to keep total number of tx per tick less than or equal NUMBER_OF_TRANSACTIONS_PER_TICK (1024 atm)
  • For now strategy is just random:
    Image

(future tx picking strategy)

Transaction* get(unsigned int tick, int index):

  • get a transaction from the pool of tick (already sorted by strategy above), return nullptr if there is no more txs

void prune(unsigned int tick):

  • Delete all info before tick
  • reorganize to save mem space
@krypdkat krypdkat added this to qubic Sep 24, 2024
@Franziska-Mueller Franziska-Mueller self-assigned this Nov 28, 2024
@Franziska-Mueller Franziska-Mueller converted this from a draft issue Nov 28, 2024
@Franziska-Mueller Franziska-Mueller moved this from 🏗 In progress to 🚫 Blocked in qubic Dec 16, 2024
@J0ET0M
Copy link
Contributor

J0ET0M commented Jan 9, 2025

waiting for #246

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🚫 Blocked
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants