Skip to content

Conversation

@philippwerner
Copy link
Contributor

@philippwerner philippwerner commented Dec 16, 2025

Improve how transaction priority is computed for new entities.

https://discord.com/channels/@me/1167399046357471242/1450385128978251796

Improve how transaction priority is computed for new entities.
@philippwerner philippwerner self-assigned this Dec 16, 2025
@philippwerner philippwerner moved this to 👀 In review in qubic Dec 16, 2025
// latestTransferTick = latestOutgoingTransferTick if latestOutgoingTransferTick > 0,
// latestTransferTick = latestIncomingTransferTick otherwise (new entity).
const EntityRecord& entity = spectrum[sourceIndex];
const auto latestTransferTick = (entity.latestOutgoingTransferTick) ? entity.latestOutgoingTransferTick : entity.latestIncomingTransferTick;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not a big fan of auto when it's not a complex type. Here I'd prefer writing unsigned int explicitly.

// latestTransferTick = latestIncomingTransferTick otherwise (new entity).
const EntityRecord& entity = spectrum[sourceIndex];
const auto latestTransferTick = (entity.latestOutgoingTransferTick) ? entity.latestOutgoingTransferTick : entity.latestIncomingTransferTick;
priority = smul(balance, static_cast<sint64>(tx->tick - latestTransferTick + 1));
Copy link
Collaborator

@Franziska-Mueller Franziska-Mueller Dec 16, 2025

Choose a reason for hiding this comment

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

While you're anyways touching this file, could you use math_lib::smul here to get rid of the qpi.h include? (we didn't have smul available outside qpi before but I moved it to math_lib for the contract exec fees)

Copy link
Collaborator

@Franziska-Mueller Franziska-Mueller left a comment

Choose a reason for hiding this comment

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

looks good now!

I suggest to wait with merging to develop until we have the first non-seamless transition after the holidays. I'd like to keep develop in a non-breaking state to facilitate optional updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

3 participants