Skip to content

feat: utxo locking #112

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

Merged
merged 9 commits into from
Oct 13, 2021
Merged

feat: utxo locking #112

merged 9 commits into from
Oct 13, 2021

Conversation

mkazlauskas
Copy link
Member

@mkazlauskas mkazlauskas commented Oct 8, 2021

Context

Need to provide functionality that wallets need to prevent double-spend attempts.

Proposed Solution

  • add availableUtxos field to UtxoRepository and implement it for InMemoryUtxoRepository
  • implement InMemoryTransactionTracker

Important Changes Introduced

  • Add flushPromises utility function to util-dev package, cslToOgmios.txIn to core package
  • Add a dependency to emittery and delay
  • Add transactionUntracked event to InMemoryUtxoRepository. To recover user should attempt to call TransactionTracker.trackTransaction manually.
  • Update MockProvider to use jest.fn for utxoDelegationAndRewards and a few other provider functions.
  • Create a ProviderError and implement the conversion for blockfrostProvider.
  • Enable eslint @typescript-eslint/no-floating-promises and disable @typescript-eslint/no-var-requires (covered by unicorn/prefer-module)

Copy link
Member

@rhyslbw rhyslbw left a comment

Choose a reason for hiding this comment

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

This was drafted in the previous review, but it must have been deleted when I thought I was de-duping responses.

@mkazlauskas mkazlauskas force-pushed the feat/utxo-lock branch 3 times, most recently from 0b6f39d to 4fd158b Compare October 12, 2021 13:23
@mkazlauskas mkazlauskas marked this pull request as ready for review October 12, 2021 13:31
@mkazlauskas mkazlauskas requested a review from rhyslbw October 12, 2021 13:32
Copy link
Member

@rhyslbw rhyslbw left a comment

Choose a reason for hiding this comment

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

Great work here @mkazlauskas . My review is still in progress, but submitting early for advanced notice. What does the withdrawal example look like positioned as an integration test? The need for an example is really just pointing out a gap in our tests, which gains us the assurance we cannot otherwise have with pure examples.

@mkazlauskas mkazlauskas requested a review from rhyslbw October 13, 2021 09:41
Copy link
Member

@rhyslbw rhyslbw 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! Please squash into minimal commits, then we're ready to merge.

feat(wallet): implement InMemoryTransactionTracker
…to it

refactor: change Provider.submitTx return type to Promise<void>, use ProviderError
refactor(wallet): change event-naming, rename trackTransaction->track, a few small improvements
@rhyslbw rhyslbw merged commit d110f8d into master Oct 13, 2021
@rhyslbw rhyslbw deleted the feat/utxo-lock branch October 13, 2021 11:14
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.

2 participants