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

Use estimated next block header in mempool validation #2033

Merged
merged 8 commits into from
Sep 26, 2023
Merged

Use estimated next block header in mempool validation #2033

merged 8 commits into from
Sep 26, 2023

Conversation

kushti
Copy link
Member

@kushti kushti commented Sep 4, 2023

In this PR, transaction validation context in mempool and API is now emulating next block (not last block mined as before).
For fields which can not be derived from the last block, following values are used:

  • miner pubkey - default group generator
  • timestamp - timestamp of last block + 1
  • votes (for changing parameters or soft-fork) - empty

close #2020

@kushti kushti changed the base branch from master to v5.0.15 September 4, 2023 16:52
@kushti kushti added this to the 5.0.15 milestone Sep 4, 2023
Copy link
Member

@aslesarenko aslesarenko left a comment

Choose a reason for hiding this comment

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

LGTM, but please see the comment.

@@ -94,17 +94,18 @@ class UtxoStateSpecification extends ErgoPropertyTest with ErgoTransactionGenera
)
val unsignedTx = new UnsignedErgoTransaction(inputs, IndexedSeq(), newBoxes)
val tx = ErgoTransaction(defaultProver.sign(unsignedTx, IndexedSeq(foundersBox), emptyDataBoxes, us.stateContext).get)
val validationRes1 = us.validateWithCost(tx, 100000)
val validationContext = us.stateContext.simplifiedUpcoming()
val validationRes1 = us.validateWithCost(tx, Some(validationContext), 100000, None)
Copy link
Member

Choose a reason for hiding this comment

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

Looks like validateWithCost is called everywhere with Some(validationContext).
Thus, us.stateContext.simplifiedUpcoming() probably can be called from validateWithCost.

Copy link
Member Author

Choose a reason for hiding this comment

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

validateWithCost arguments simplified

@kushti kushti merged commit b88fd96 into v5.0.15 Sep 26, 2023
3 of 4 checks passed
@kushti kushti deleted the i2020 branch September 26, 2023 13:47
@kushti kushti mentioned this pull request Sep 26, 2023
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.

Use estimated next block header in mempool validation
3 participants