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

Track malleated tx events #607

Merged
merged 7 commits into from
Jan 10, 2022

Conversation

evan-forbes
Copy link
Member

Description

This PR adds an additional check when publishing an event to see if the tx was malleated. If so, it uses the "parent"'s (the tx before being malleated) hash as a key.

This solution works in a similar way to #581, and has the same downsides. Those being that it's a rather hacky solution, requires an extra hash be stored with each PayForMessage, and that each time a transaction event is published, there is an extra check.

While this works, more thought should be put into finding a better solution.

Closes: #590
Unblocks dalc #17
Unblocks celestia-app #171

types/event_bus_test.go Outdated Show resolved Hide resolved
@Wondertan
Copy link
Member

Probably a stupid Q: why parent transactions or transaction wrapping are/is needed?

@evan-forbes
Copy link
Member Author

evan-forbes commented Jan 6, 2022

Probably a stupid Q: why parent transactions or transaction wrapping are/is needed?

tendermint relies on the hash of the tx that the user is submitting to be the same as the tx that is committed to. This isn't the case for us, the hash of WirePayForMessage that the user submits and the PayForMessage that actually gets committed to will always be different.

By arbitrarily replacing the the tx hash with it's "parent" hash, we are hacking tendermint to notify the user that their transaction was actually committed to. That's why this solution, along with the mempool one that working via the same mechanism, is hacky and we should be able to do better. In the mean time though, this unblocks the DALC, which is overdue.

@adlerjohn adlerjohn linked an issue Jan 9, 2022 that may be closed by this pull request
types/tx.go Outdated
// passed is not a tmproto.ChildTx, since the schema for PayForMessage is kept
// in the app, we cannot perform further checks without creating an import
// cycle.
func UnwrapChildTx(tx Tx) (parentHash []byte, unwrapped Tx, isChild bool) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe orthogonal to this PR, but semantically should this not return an error instead of a Boolean?

@liamsi
Copy link
Member

liamsi commented Jan 10, 2022

Probably a stupid Q: why parent transactions or transaction wrapping are/is needed?

Would it help if the names were different? The parent Tx is essentially the original Tx, the submitted Tx, the mempool Tx, while the child Tx, is the (processed/malleated) block Tx. But we can also bikeshed about the name later. Just wanted to ask if it would make things clearer (I think it would for me).

On another note: created a branch protection rule to apply to v[0-9].[0-9][0-9].x-celestia

Copy link
Member

@tzdybal tzdybal left a comment

Choose a reason for hiding this comment

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

LGTM

@evan-forbes
Copy link
Member Author

Would it help if the names were different? The parent Tx is essentially the original Tx, the submitted Tx, the mempool Tx, while the child Tx, is the (processed/malleated) block Tx. But we can also bikeshed about the name later. Just wanted to ask if it would make things clearer (I think it would for me).

good point, changed ChildTx to Malleated and ParentTx to OriginalTx ff465e2

On another note: created a branch protection rule to apply to v[0-9].[0-9][0-9].x-celestia

definitley!! can someone with appropriate repo permissions do this? It would be much appreciated.

@evan-forbes
Copy link
Member Author

evan-forbes commented Jan 10, 2022

The proto linter fails because we're not using v1 of buf, but running the make proto-gen changes it back to v1beta1, so 🤷‍♂️

will hopefully fix with #566

Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

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

👏🏼

Copy link
Member

@adlerjohn adlerjohn left a comment

Choose a reason for hiding this comment

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

utACK

@evan-forbes evan-forbes merged commit 266919c into v0.34.x-celestia Jan 10, 2022
@evan-forbes evan-forbes deleted the evan/track-malleated-tx-events branch January 10, 2022 17:42
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.

Support malleated transactions in the event system
5 participants