Skip to content

Cleanup X-chain UniqueTx Dependencies #1656

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 44 commits into from
Jun 27, 2023
Merged

Conversation

StephenButtolph
Copy link
Contributor

Why this should be merged

Continuing the push to make UniqueTx as minimal as possible. Once we remove Statuses from being persisted my conquest will abide here.

How this works

How this was tested

@StephenButtolph StephenButtolph self-assigned this Jun 26, 2023
@StephenButtolph StephenButtolph added vm This involves virtual machines cleanup Code quality improvement labels Jun 26, 2023
@StephenButtolph StephenButtolph mentioned this pull request Jun 26, 2023
3 tasks
Base automatically changed from simplify-unique-tx-2-v2 to dev June 27, 2023 03:20
Comment on lines -237 to -243
assets := tx.AssetIDs()
require.Len(assets, 1)
require.Contains(assets, assetID)

consumedAssets := tx.ConsumedAssetIDs()
require.Len(consumedAssets, 1)
require.Contains(consumedAssets, assetID)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These functions no longer exist

Comment on lines +398 to +400
tx0 := &testTx{
Tx: innerTx0,
tx: tx1,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This updates the dependencies of tx1 to be empty after tx0 is accepted.

@@ -54,26 +54,6 @@ func (t *OperationTx) InputIDs() set.Set[ids.ID] {
return inputs
}

// ConsumedAssetIDs returns the IDs of the assets this transaction consumes
func (t *OperationTx) ConsumedAssetIDs() set.Set[ids.ID] {
assets := t.AssetIDs()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was incorrect before. It should have been assets := t.BaseTx.AssetIDs().

})
if inputTx.Status() != choices.Accepted {
txIDs.Add(txID)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This loop was only needed if someone created a Fx with an Operation that could be issued with no Input UTXOs. However, no such Fx was ever added - and so it is safe to remove (as all chains are now linearized).

@StephenButtolph StephenButtolph added this to the v1.10.4 milestone Jun 27, 2023
Comment on lines -169 to -171
if tx.Tx == nil || len(tx.deps) != 0 {
return tx.deps, nil
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: tx.Tx can never be nil here because MissingDependencies() is only called from txs returned from ParseTx (which can clearly never have a nil tx.Tx).

@StephenButtolph StephenButtolph marked this pull request as ready for review June 27, 2023 03:57
@StephenButtolph StephenButtolph merged commit a9ec5e8 into dev Jun 27, 2023
@StephenButtolph StephenButtolph deleted the simplify-unique-tx-3-v2 branch June 27, 2023 16:47
danlaine pushed a commit to danlaine/avalanchego that referenced this pull request Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code quality improvement vm This involves virtual machines
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants