forest/shim/
randomness.rs1use super::fvm_shared_latest::randomness::Randomness as Randomness_latest;
5use fvm_shared2::randomness::Randomness as Randomness_v2;
6use fvm_shared3::randomness::Randomness as Randomness_v3;
7use serde::{Deserialize, Serialize};
8
9#[derive(
32 PartialEq,
33 Eq,
34 Default,
35 Clone,
36 Debug,
37 Deserialize,
38 Serialize,
39 derive_more::Deref,
40 derive_more::DerefMut,
41 derive_more::From,
42 derive_more::Into,
43)]
44#[serde(transparent)]
45pub struct Randomness(Randomness_latest);
46
47impl Randomness {
48 pub fn new(rand: Vec<u8>) -> Self {
49 Randomness(Randomness_latest(rand))
50 }
51}
52
53impl From<Randomness_v3> for Randomness {
54 fn from(other: Randomness_v3) -> Self {
55 Randomness(Randomness_latest(other.0))
56 }
57}
58
59impl From<Randomness_v2> for Randomness {
60 fn from(other: Randomness_v2) -> Self {
61 Randomness(Randomness_latest(other.0))
62 }
63}
64
65impl From<Randomness> for Randomness_v3 {
66 fn from(other: Randomness) -> Self {
67 Self(other.0.0)
68 }
69}
70
71impl From<Randomness> for Randomness_v2 {
72 fn from(other: Randomness) -> Self {
73 Self(other.0.0)
74 }
75}