Repository: ergoplatform/sigma-rust (language: rust)

Issue:
Type mismatch in coinbase script (MINER_PUBKEY should be a byte array)
It contains construct `DecodePoint(MINER_PUBKEY)` but `MINER_PUBKEY` has type `SGroupElement` and `DecodePoint` require input of type `SColl<SByte>`. Someone is clearly in the wrong here. 


Discussion / hints:
Yeah, sigma-rust got it wrong. `MINER_PUBKEY` should be a byte array. 
Here is the Scala version - https://github.com/ScorexFoundation/sigmastate-interpreter/blob/89afefa935d52dd83741f6530f97e4c935992f76/sigmastate/src/main/scala/org/ergoplatform/ErgoLikeContext.scala#L230-L241

On eval group element should be serialized here - https://github.com/ergoplatform/sigma-rust/blob/e779150b336a1c099204a344387d2c63f880ef1b/ergotree-interpreter/src/eval/global_vars.rs#L16



Fix patch:
diff --git a/ergotree-interpreter/src/eval/global_vars.rs b/ergotree-interpreter/src/eval/global_vars.rs
index ab749b59c..97540fbc9 100644
--- a/ergotree-interpreter/src/eval/global_vars.rs
+++ b/ergotree-interpreter/src/eval/global_vars.rs
@@ -5,6 +5,7 @@ use ergotree_ir::mir::value::Value;
 use super::EvalContext;
 use super::EvalError;
 use super::Evaluable;
+use ergotree_ir::serialization::SigmaSerializable;
 
 impl Evaluable for GlobalVars {
     fn eval(&self, _env: &Env, ectx: &mut EvalContext) -> Result<Value, EvalError> {
@@ -13,7 +14,9 @@ impl Evaluable for GlobalVars {
             GlobalVars::SelfBox => Ok(ectx.ctx.self_box.clone().into()),
             GlobalVars::Outputs => Ok(ectx.ctx.outputs.clone().into()),
             GlobalVars::Inputs => Ok(ectx.ctx.inputs.clone().into()),
-            GlobalVars::MinerPubKey => Ok(ectx.ctx.pre_header.miner_pk.clone().into()),
+            GlobalVars::MinerPubKey => {
+                Ok(ectx.ctx.pre_header.miner_pk.sigma_serialize_bytes().into())
+            }
         }
     }
 }
diff --git a/ergotree-ir/src/mir/global_vars.rs b/ergotree-ir/src/mir/global_vars.rs
index c8768eed4..20576dc7e 100644
--- a/ergotree-ir/src/mir/global_vars.rs
+++ b/ergotree-ir/src/mir/global_vars.rs
@@ -27,7 +27,7 @@ impl GlobalVars {
             GlobalVars::Outputs => SType::SColl(Box::new(SType::SBox)),
             GlobalVars::Height => SType::SInt,
             GlobalVars::SelfBox => SType::SBox,
-            GlobalVars::MinerPubKey => SType::SGroupElement,
+            GlobalVars::MinerPubKey => SType::SColl(Box::new(SType::SByte)),
         }
     }
 }


Test patch: