mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-26 08:47:57 +00:00
94ec34c4d5
Separate between compilation and linker phases to allow deploy time linking and back-porting era compiler changes to fix #91. Unlinked contract binaries (caused by missing libraries or missing factory dependencies in turn) are emitted as raw ELF object. Few drive by fixes: - #98 - A compiler panic on missing libraries definitions. - Fixes some incosistent type forwarding in JSON output (empty string vs. null object). - Remove the unused fallback for size optimization setting. - Remove the broken `--lvm-ir` mode. - CI workflow fixes. --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com> Signed-off-by: xermicus <bigcyrill@hotmail.com> Signed-off-by: xermicus <cyrill@parity.io>
43 lines
1.1 KiB
Rust
43 lines
1.1 KiB
Rust
//! The metadata hash type.
|
|
|
|
use std::str::FromStr;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// The metadata hash type.
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
pub enum MetadataHash {
|
|
/// Do not include bytecode hash.
|
|
#[serde(rename = "none")]
|
|
None,
|
|
/// Include the `ipfs` hash.
|
|
#[serde(rename = "ipfs")]
|
|
IPFS,
|
|
/// Include the `keccak256`` hash.
|
|
#[serde(rename = "keccak256")]
|
|
Keccak256,
|
|
}
|
|
|
|
impl FromStr for MetadataHash {
|
|
type Err = anyhow::Error;
|
|
|
|
fn from_str(string: &str) -> Result<Self, Self::Err> {
|
|
match string {
|
|
"none" => Ok(Self::None),
|
|
"ipfs" => Ok(Self::IPFS),
|
|
"keccak256" => Ok(Self::Keccak256),
|
|
string => anyhow::bail!("unknown bytecode hash mode: `{string}`"),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::fmt::Display for MetadataHash {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
|
match self {
|
|
Self::None => write!(f, "none"),
|
|
Self::IPFS => write!(f, "ipfs"),
|
|
Self::Keccak256 => write!(f, "keccak256"),
|
|
}
|
|
}
|
|
}
|