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

Add a flag on whether blockchain context is used in ErgoTree #928

Closed
kushti opened this issue Oct 27, 2023 · 2 comments · Fixed by #929
Closed

Add a flag on whether blockchain context is used in ErgoTree #928

kushti opened this issue Oct 27, 2023 · 2 comments · Fixed by #929

Comments

@kushti
Copy link
Member

kushti commented Oct 27, 2023

For the sake of optimizations (see e.g. https://www.ergoforum.org/t/protecting-mempool-from-computationally-heavy-transactions/231 ), it is worth to introduce, similarly to hasDeserialize flag, a new flag isUsingBlockchainContext, which is set when ErgoTree depends on blockchain context, so following fields of context are read there:

  /** Height (block number) of the block which is currently being validated. */
  def HEIGHT: Int

  /** Authenticated dynamic dictionary digest representing Utxo state before current state. */
  def LastBlockUtxoRootHash: AvlTree

  /** A fixed number of last block headers in descending order (first header is the newest one) */
  def headers: Coll[Header]

  /** Fields of a new block header, that can be predicted by a miner before block's formation */
  def preHeader: PreHeader

  /** Bytes of encoded miner's public key.
    * Same as `preHeader.minerPk.getEncoded`
    */
  def minerPubKey: Coll[Byte]
@kushti kushti added this to the v5.x milestone Oct 27, 2023
@megatron00999
Copy link
Contributor

@kushti I will try adding this.

@kushti
Copy link
Member Author

kushti commented Jan 24, 2024

added in 5.0.14

@kushti kushti closed this as completed Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants