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

Correct environment for Template Compiler #977

Merged
merged 9 commits into from
May 12, 2024

Conversation

aslesarenko
Copy link
Member

@aslesarenko aslesarenko commented May 9, 2024

Closes #966
In this PR:

  • fixed parsing of ContractParam
  • default parameter values used to create environment for Compiler
  • default parameter values are merged with explicitly provided to applyTemplate
  • more tests for SigmaTemplateCompiler
  • added ErgoTreeUtils.explainTreeHeader
  • tests for ContractTemplate.applyTemplate method

@aslesarenko aslesarenko self-assigned this May 9, 2024
@aslesarenko aslesarenko added the A-frontend Area: ErgoScript compiler (source -> ErgoTree) label May 9, 2024
@aslesarenko aslesarenko requested a review from kushti May 9, 2024 22:59
@Luivatra
Copy link

By adding the parameters in the template compile step wont this end up with an ergotree with no ConstantPlaceholders for the parameters? I don't think the SigmaTemplateCompiler can differentiate between normal constants and parameter values.

@aslesarenko aslesarenko removed the request for review from kushti May 11, 2024 12:03
@aslesarenko aslesarenko marked this pull request as draft May 11, 2024 12:03
@aslesarenko aslesarenko marked this pull request as ready for review May 12, 2024 16:50
@aslesarenko aslesarenko requested a review from kushti May 12, 2024 17:32
@@ -19,6 +18,7 @@ import scala.collection.mutable.ArrayBuffer
*/
class SigmaTyper(val builder: SigmaBuilder,
Copy link
Member

Choose a reason for hiding this comment

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

ScalaDoc (class args description) is missed

Copy link
Member Author

Choose a reason for hiding this comment

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

done

"""/**/
|@contract def contractName(low: Int = 0, high: Int) = sigmaProp(low < HEIGHT && HEIGHT < high) && condition
|""".stripMargin
val env: ScriptEnv = Map.empty // no value for "high"
Copy link
Member

Choose a reason for hiding this comment

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

env is not used

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@aslesarenko aslesarenko merged commit 8af5260 into develop May 12, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: ErgoScript compiler (source -> ErgoTree)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SigmaTemplateCompiler (EIP-5) does not take non-parameter constants into account
3 participants