ScorexFoundation / sigmastate-interpreter

ErgoScript compiler and ErgoTree Interpreter implementation for Ergo blockchain
MIT License
62 stars 40 forks source link

Missing upcast in typer for ByIndex #545

Open greenhat opened 5 years ago

greenhat commented 5 years ago

In the following code i(in get(i)) did not get upcasted to Int in the typer:

 {
   OUTPUTS(0).R8[Coll[Byte]].get.forall({(i:Byte) =>
      coll5.forall({(j:Byte) =>
        OUTPUTS(0).R8[Coll[Byte]].get(i) == OUTPUTS(0).R8[Coll[Byte]].get(32700 - j)
      })
   })
 }

from https://github.com/ScorexFoundation/sigmastate-interpreter/blob/1b7e45f6b112b5d998033745086b94feb1c82fd9/src/test/scala/sigmastate/utxo/SpamSpecification.scala#L329

aslesarenko commented 4 years ago

@greenhat Is it still relevant and why it is a problem? Error message, how to reproduce?

greenhat commented 4 years ago

@aslesarenko It should be relevant. The problem is upcast is added only after a serializer roundtrip and an error message was about failing roundtrip.
Although I see that there is an upcast call in the SigmaTyper that's quite old. So maybe this issue needs re-assessment.