Skip to content

Commit

Permalink
[compiler-v2 framework] fixed fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
welbon committed Dec 13, 2024
1 parent d769d1e commit e08e9cb
Showing 1 changed file with 47 additions and 17 deletions.
64 changes: 47 additions & 17 deletions vm/framework/src/natives/cryptography/algebra/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ impl TryFrom<TypeTag> for Structure {

fn try_from(value: TypeTag) -> Result<Self, Self::Error> {
match value.to_string().as_str() {
"0x00000000000000000000000000000001::bls12381_algebra::Fr" => Ok(Structure::BLS12381Fr),
"0x00000000000000000000000000000001::bls12381_algebra::Fq12" => Ok(Structure::BLS12381Fq12),
"0x00000000000000000000000000000001::bls12381_algebra::Fr" => Ok(Structure::BLS12381Fr),
"0x00000000000000000000000000000001::bls12381_algebra::Fq12" => {
Ok(Structure::BLS12381Fq12)
}
"0x00000000000000000000000000000001::bls12381_algebra::G1" => Ok(Structure::BLS12381G1),
"0x00000000000000000000000000000001::bls12381_algebra::G2" => Ok(Structure::BLS12381G2),
"0x00000000000000000000000000000001::bls12381_algebra::Gt" => Ok(Structure::BLS12381Gt),
Expand Down Expand Up @@ -131,25 +133,53 @@ impl TryFrom<TypeTag> for SerializationFormat {
"0x00000000000000000000000000000001::bls12381_algebra::FormatG1Uncompr" => {
Ok(SerializationFormat::BLS12381G1Uncompressed)
}
"0x00000000000000000000000000000001::bls12381_algebra::FormatG1Compr" => Ok(SerializationFormat::BLS12381G1Compressed),
"0x00000000000000000000000000000001::bls12381_algebra::FormatG1Compr" => {
Ok(SerializationFormat::BLS12381G1Compressed)
}
"0x00000000000000000000000000000001::bls12381_algebra::FormatG2Uncompr" => {
Ok(SerializationFormat::BLS12381G2Uncompressed)
}
"0x00000000000000000000000000000001::bls12381_algebra::FormatG2Compr" => Ok(SerializationFormat::BLS12381G2Compressed),
"0x00000000000000000000000000000001::bls12381_algebra::FormatGt" => Ok(SerializationFormat::BLS12381Gt),
"0x00000000000000000000000000000001::bls12381_algebra::FormatFrLsb" => Ok(SerializationFormat::BLS12381FrLsb),
"0x00000000000000000000000000000001::bls12381_algebra::FormatFrMsb" => Ok(SerializationFormat::BLS12381FrMsb),

"0x00000000000000000000000000000001::bn254_algebra::FormatG1Uncompr" => Ok(Self::BN254G1Uncompressed),
"0x00000000000000000000000000000001::bn254_algebra::FormatG1Compr" => Ok(Self::BN254G1Compressed),
"0x00000000000000000000000000000001::bn254_algebra::FormatG2Uncompr" => Ok(Self::BN254G2Uncompressed),
"0x00000000000000000000000000000001::bn254_algebra::FormatG2Compr" => Ok(Self::BN254G2Compressed),
"0x00000000000000000000000000000001::bls12381_algebra::FormatG2Compr" => {
Ok(SerializationFormat::BLS12381G2Compressed)
}
"0x00000000000000000000000000000001::bls12381_algebra::FormatGt" => {
Ok(SerializationFormat::BLS12381Gt)
}
"0x00000000000000000000000000000001::bls12381_algebra::FormatFrLsb" => {
Ok(SerializationFormat::BLS12381FrLsb)
}
"0x00000000000000000000000000000001::bls12381_algebra::FormatFrMsb" => {
Ok(SerializationFormat::BLS12381FrMsb)
}

"0x00000000000000000000000000000001::bn254_algebra::FormatG1Uncompr" => {
Ok(Self::BN254G1Uncompressed)
}
"0x00000000000000000000000000000001::bn254_algebra::FormatG1Compr" => {
Ok(Self::BN254G1Compressed)
}
"0x00000000000000000000000000000001::bn254_algebra::FormatG2Uncompr" => {
Ok(Self::BN254G2Uncompressed)
}
"0x00000000000000000000000000000001::bn254_algebra::FormatG2Compr" => {
Ok(Self::BN254G2Compressed)
}
"0x00000000000000000000000000000001::bn254_algebra::FormatGt" => Ok(Self::BN254Gt),
"0x00000000000000000000000000000001::bn254_algebra::FormatFrLsb" => Ok(Self::BN254FrLsb),
"0x00000000000000000000000000000001::bn254_algebra::FormatFrMsb" => Ok(Self::BN254FrMsb),
"0x00000000000000000000000000000001::bn254_algebra::FormatFqLsb" => Ok(Self::BN254FqLsb),
"0x00000000000000000000000000000001::bn254_algebra::FormatFqMsb" => Ok(Self::BN254FqMsb),
"0x00000000000000000000000000000001::bn254_algebra::FormatFq12LscLsb" => Ok(Self::BN254Fq12LscLsb),
"0x00000000000000000000000000000001::bn254_algebra::FormatFrLsb" => {
Ok(Self::BN254FrLsb)
}
"0x00000000000000000000000000000001::bn254_algebra::FormatFrMsb" => {
Ok(Self::BN254FrMsb)
}
"0x00000000000000000000000000000001::bn254_algebra::FormatFqLsb" => {
Ok(Self::BN254FqLsb)
}
"0x00000000000000000000000000000001::bn254_algebra::FormatFqMsb" => {
Ok(Self::BN254FqMsb)
}
"0x00000000000000000000000000000001::bn254_algebra::FormatFq12LscLsb" => {
Ok(Self::BN254Fq12LscLsb)
}
_ => Err(()),
}
}
Expand Down

0 comments on commit e08e9cb

Please sign in to comment.