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

Introduce TxInput::OrderAccountCommand without nonces #1888

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

azarovh
Copy link
Member

@azarovh azarovh commented Feb 28, 2025

  • Filled amount is now calculated based on the original ask/give price. This makes fill operations commutative. Though it has a negative consequence as potential remainder amounts, resulting in dust utxos produced on conclude, I don't think it's a major problem.

  • It is forbidden to fill order with 0 to enforce spending utxo in a tx making it unique and not replayable.

  • Nonce for AccountCommand::FillOrder is ignored. This is a bit hacky because nonce is still present making it confusing. But I think that this is more like an exception and refactoring out nonce from TxInput::AccountCommand seems like not worth it.

  • Nonce for AccountCommand::ConcludeOrder is kept. Also I'm planning to keep it for the upcoming AccountCommand::FreezeOrder. Though it seems like it can be removed I don't see a point in doing it.

  • Ignoring nonce forced me to add fork logic to TransactionVerifier::disconnect_transaction function because we don't need to decrement nonce for fill orders after the fork.

  • Same fork logic goes into api-server and wallet. Though for wallet it required changing OutputCache logic which looks messy and I'm don't quite like it (alternative solution below can fix that).

UPDATE:

  • Introduced new TxInput::OrderAccountCommand with FillOrder and ConcludeOrder commands.
  • Nonces for OrderAccountCommand are completely removed.
  • OrderAccountCommand::ConcludeOrder now contains remaining amounts that can be withdrawn from an account so that these amount can be used by hw wallet and also get into a signature. Also these amounts are checked in TransactionVerifier

@azarovh azarovh force-pushed the fix/fill_order_no_nonce branch from fcf7fc6 to b6d9b5d Compare March 4, 2025 15:58
@azarovh azarovh force-pushed the fix/fill_order_no_nonce branch from 6e4bf6f to 461b8fa Compare March 5, 2025 10:44
@azarovh azarovh changed the title Ignore nonces in fill order operations Introduce TxInput::OrderAccountCommand without nonces Mar 5, 2025
@azarovh azarovh force-pushed the fix/fill_order_no_nonce branch from b558f29 to 8c03c73 Compare March 5, 2025 13:35
@azarovh azarovh marked this pull request as ready for review March 5, 2025 13:45
@azarovh azarovh force-pushed the fix/fill_order_no_nonce branch from 8c03c73 to 816b30b Compare March 5, 2025 15:41
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.

1 participant