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

NODE-2616 Refactored validation of transaction version #3906

Merged
merged 20 commits into from
Nov 29, 2023

Conversation

xrtm000
Copy link
Member

@xrtm000 xrtm000 commented Oct 24, 2023

No description provided.

@xrtm000 xrtm000 marked this pull request as ready for review October 25, 2023 09:08
@xrtm000 xrtm000 requested a review from phearnot as a code owner October 25, 2023 09:08
@@ -1,11 +1,19 @@
package com.wavesplatform.transaction

trait VersionedTransaction {
def version: TxVersion
val version: TxVersion
val maxVersion: TxVersion
Copy link
Member

Choose a reason for hiding this comment

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

Moving maxVersion to TransactionType would better reflect the reality, since max version is a property of transaction type, rather than some particular transaction

Copy link
Member Author

Choose a reason for hiding this comment

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

Refactored

@xrtm000 xrtm000 requested a review from phearnot November 8, 2023 11:06
Copy link
Member

@phearnot phearnot left a comment

Choose a reason for hiding this comment

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

  • EthereumTransaction should be neither VersionedTransaction nor PBSince

@@ -1,11 +1,13 @@
package com.wavesplatform.transaction

trait VersionedTransaction {
def version: TxVersion
sealed trait VersionedTransaction {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
sealed trait VersionedTransaction {
sealed trait VersionedTransaction {
def version: TxVersion
protected def maxVersion: TxVersion
def isVersionValid: Boolean = 0 < version && version <= maxVersion
}
object VersionedTransaction {
trait OnlyV1 extends VersionedTransaction {
override val version: TxVersion = TxVersion.V1
override val maxVersion: TxVersion = TxVersion.V1
}
trait ToV2 extends VersionedTransaction {
override val maxVersion: TxVersion = TxVersion.V2
}
trait ToV3 extends VersionedTransaction {
override val maxVersion: TxVersion = TxVersion.V3
}
}

@phearnot phearnot merged commit c087618 into version-1.5.x Nov 29, 2023
1 of 2 checks passed
@phearnot phearnot deleted the node-2616-refactored-tx-version-validation branch November 29, 2023 13:26
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.

5 participants