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

Store txConflicting reason correctly and rename ConflictDAG to SpendDAG #508

Merged
merged 27 commits into from
Nov 29, 2023

Conversation

jkrvivian
Copy link
Contributor

@jkrvivian jkrvivian commented Nov 8, 2023

  • Remove optForkAllTransactions option. The default is to fork all transactions.

  • Store conflicting transaction failure reason on TransactionMetadata OnRejected event.

  • Rename ConflictDAG to SpendDAG.
    Since we fork every transaction, not just conflicts are included.

  • Rename Conflict to Spender and ConflictID to SpenderID because these objects represent transactions (transactions are generically referred to as a spender, and an output is generically referred to as a resource).

Close #462

@jkrvivian jkrvivian requested a review from karimodm November 8, 2023 13:40
@jkrvivian jkrvivian force-pushed the fix/conflicting-tx-reason branch from 64bf4f1 to 2857d11 Compare November 9, 2023 07:43
@jkrvivian jkrvivian requested a review from piotrm50 November 9, 2023 08:14
Copy link
Collaborator

@piotrm50 piotrm50 left a comment

Choose a reason for hiding this comment

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

Please run a search through the whole codebase again as there seems to be a lot conflicts left.

components/dashboard/type.go Outdated Show resolved Hide resolved
pkg/protocol/engine/mempool/spenddag/tests/assertions.go Outdated Show resolved Hide resolved
pkg/protocol/engine/mempool/spenddag/events.go Outdated Show resolved Hide resolved
pkg/protocol/engine/mempool/spenddag/events.go Outdated Show resolved Hide resolved
pkg/protocol/engine/mempool/spenddag/events.go Outdated Show resolved Hide resolved
@jkrvivian jkrvivian requested a review from piotrm50 November 15, 2023 09:12
@cyberphysic4l
Copy link
Contributor

cyberphysic4l commented Nov 20, 2023

  • A spendable resource is identified by an iotago.OutputID, we don't need a generic ResourceID just for the spend DAG because we are always talking about about utxos which are just iotago.Output . We should drop the generic "resource" because it's not actually generic in how we use it so it is just unhelpful. resources should be referred to as utxos.

  • A Transaction contains one or more spends, each of different outputs. A spend can be therefore be identified by a tuple (iotago.TransactionID, iotago.OutputID) . What we previously called SpendID or ConflictID was actually just a iotago.TransactionID . This is incorrect because a spend != transaction, it is a spend of a specific utxo within a transaction, so it needs a transaction ID and output ID to identify it uniquely. We should get rid of ConflictID/SpendID altogether.

  • What we previously called a ConflictSet should now be a called a SpendSet . Each SpendSet corresponds to a single utxo. If the SpendSet contains more than one spend for that utxo, then we say that it contains a conflict. There will be no object called a conflict anymore, but a conflict can be identified by a spend set containing more than one spend or by a spend with a set of ConflictingSpends associated to it that is not empty.

Copy link
Collaborator

@piotrm50 piotrm50 left a comment

Choose a reason for hiding this comment

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

Another batch of missed conflict renames.

@@ -222,10 +222,10 @@ class OutputMeta extends React.Component<omProps, any> {
let pendingMana = this.props.pendingMana;
return (
<ListGroup>
ConflictIDs:
spendIDs:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing capital letter in Spend here and in other .tsx files.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why was that resolved without a comment? Because I also don't get the change...

pkg/protocol/engine/mempool/spenddag/tests/assertions.go Outdated Show resolved Hide resolved
pkg/protocol/engine/mempool/spenddag/tests/tests.go Outdated Show resolved Hide resolved
pkg/protocol/engine/mempool/tests/tests.go Show resolved Hide resolved
@jkrvivian jkrvivian force-pushed the fix/conflicting-tx-reason branch from 23fb3ff to aa045a2 Compare November 21, 2023 11:57
Copy link
Collaborator

@muXxer muXxer left a comment

Choose a reason for hiding this comment

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

This is such a massive "renaming PR".... I don't like that it also includes logic changes at the same time.

For the next time you do such a refactor, it would be much better to split it up into several PRs.

For example, use the rename capability of the IDE only, no "find & replace" (I see that you used that because uncommented code also changed). And then create commits per single "rename". This is much easier to check, because we all can simply trust your IDE.

The logic changes should be part of another PR next time.

Regarding the new naming and the logic, I totally agree with @cyberphysic4l 's comment.
Maybe we should create another type for the tuple of (iotago.TransactionID, iotago.OutputID) in another PR and fix the logic.

I also think the usage of "transactionID" instead of "spendID" in some places makes more sense.

Should we merge this PR or will this heavily conflict with the react branches?

@@ -222,10 +222,10 @@ class OutputMeta extends React.Component<omProps, any> {
let pendingMana = this.props.pendingMana;
return (
<ListGroup>
ConflictIDs:
spendIDs:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why was that resolved without a comment? Because I also don't get the change...

@jkrvivian jkrvivian requested a review from piotrm50 November 29, 2023 09:29
@jkrvivian jkrvivian merged commit 26441e4 into develop Nov 29, 2023
4 checks passed
@jkrvivian jkrvivian deleted the fix/conflicting-tx-reason branch November 29, 2023 11:55
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.

REST-API sometimes returns conflicting transactions, but there are no conflicts
4 participants