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

Issue:
[150 SigmaUSD] Define `PreHeader` `STypeCompanion` with properties
from #418
PreHeader properties definitions in `spreheader` module (see `sheader` module for examples). Define `SMethod` for each property.
Reference Scala implementation - https://github.com/ScorexFoundation/sigmastate-interpreter/blob/c863a9b1a82589e47b15f76f3affdb30a475e740/sigmastate/src/main/scala/sigmastate/types.scala#L2497-L2528


Discussion / hints:
Hey!

I'm starting on this one

Fix patch:
diff --git a/ergotree-ir/src/types/spreheader.rs b/ergotree-ir/src/types/spreheader.rs
index cd08eb7df..71d605822 100644
--- a/ergotree-ir/src/types/spreheader.rs
+++ b/ergotree-ir/src/types/spreheader.rs
@@ -1,8 +1,10 @@
+#![allow(missing_docs)]
+
 use crate::serialization::types::TypeCode;
 
-use super::smethod::MethodId;
-use super::smethod::SMethodDesc;
+use super::smethod::{MethodId, SMethod, SMethodDesc};
 use super::stype::SType;
+use super::stype_companion::STypeCompanion;
 use crate::types::stype::SType::{SByte, SColl};
 use lazy_static::lazy_static;
 
@@ -27,32 +29,46 @@ lazy_static! {
 }
 
 lazy_static! {
+    pub static ref VERSION_PROPERTY: SMethod =
+        SMethod::new(STypeCompanion::PreHeader, VERSION_METHOD.clone());
     static ref VERSION_METHOD: SMethodDesc = property("version", SByte, MethodId(1));
 }
 
 lazy_static! {
+    pub static ref PARENT_ID_PROPERTY: SMethod =
+        SMethod::new(STypeCompanion::PreHeader, PARENT_ID_METHOD.clone());
     static ref PARENT_ID_METHOD: SMethodDesc =
         property("parentId", SColl(SByte.into()), MethodId(2));
 }
 
 lazy_static! {
+    pub static ref TIMESTAMP_PROPERTY: SMethod =
+        SMethod::new(STypeCompanion::PreHeader, TIMESTAMP_METHOD.clone());
     static ref TIMESTAMP_METHOD: SMethodDesc = property("timestamp", SType::SLong, MethodId(3));
 }
 
 lazy_static! {
+    pub static ref N_BITS_PROPERTY: SMethod =
+        SMethod::new(STypeCompanion::PreHeader, N_BITS_METHOD.clone());
     static ref N_BITS_METHOD: SMethodDesc = property("nBits", SType::SLong, MethodId(4));
 }
 
 lazy_static! {
+    pub static ref HEIGHT_PROPERTY: SMethod =
+        SMethod::new(STypeCompanion::PreHeader, HEIGHT_METHOD.clone());
     static ref HEIGHT_METHOD: SMethodDesc = property("height", SType::SInt, MethodId(5));
 }
 
 lazy_static! {
+    pub static ref MINER_PK_PROPERTY: SMethod =
+        SMethod::new(STypeCompanion::PreHeader, MINER_PK_METHOD.clone());
     static ref MINER_PK_METHOD: SMethodDesc =
         property("minerPk", SType::SGroupElement, MethodId(6));
 }
 
 lazy_static! {
+    pub static ref VOTES_PROPERTY: SMethod =
+        SMethod::new(STypeCompanion::PreHeader, VOTES_METHOD.clone());
     static ref VOTES_METHOD: SMethodDesc = property("votes", SColl(SByte.into()), MethodId(7));
 }
 


Test patch: