-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Motivation:
current implementation of ContextExtension (auxiliary data provided during spending a UTXO in a transaction input) is using default Scala SDK's Map implementation:
case class ContextExtension(values: scala.collection.Map[Byte, EvaluatedValue[_ <: SType]])
which is preserving insertion order only for up to four elements (as under the hood specialized Map1 ... Map4 implementations are used).
As insertion order is consensus-critical, there is need to replace scala.collection.Map with own implementation which preserves insertion order, to be safe against possible traversal order changes in future versions of SDK, and also gives possibility to translate implementation to JS and Rust.
Enough interface for SigmaMap can be found in #951 , along with beginning of implementation and some tests. There is need to finish implementation for the whole Byte range and check traversal order against scala.collection.Map[Byte, EvaluatedValue[_ <: SType]] in tests
related: #681