Skip to content

Commit

Permalink
use the long revive version string in the contract metadata (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
xermicus authored Oct 31, 2024
1 parent 173ace7 commit 9267a2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 6 additions & 5 deletions crates/solidity/src/project/contract/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

use serde::Serialize;

use crate::ResolcVersion;

/// The Solidity contract metadata.
/// Is used to append the metadata hash to the contract bytecode.
#[derive(Debug, Serialize)]
pub struct Metadata {
/// The `solc` metadata.
pub solc_metadata: serde_json::Value,
/// The `solc` version.
pub solc_version: semver::Version,
pub solc_version: String,
/// The pallet revive edition.
pub revive_pallet_version: Option<semver::Version>,
/// The PolkaVM compiler version.
pub revive_version: semver::Version,
pub revive_version: String,
/// The PolkaVM compiler optimizer settings.
pub optimizer_settings: revive_llvm_context::OptimizerSettings,
}
Expand All @@ -22,16 +24,15 @@ impl Metadata {
/// A shortcut constructor.
pub fn new(
solc_metadata: serde_json::Value,
solc_version: semver::Version,
solc_version: String,
revive_pallet_version: Option<semver::Version>,
revive_version: semver::Version,
optimizer_settings: revive_llvm_context::OptimizerSettings,
) -> Self {
Self {
solc_metadata,
solc_version,
revive_pallet_version,
revive_version,
revive_version: ResolcVersion::default().long,
optimizer_settings,
}
}
Expand Down
3 changes: 1 addition & 2 deletions crates/solidity/src/project/contract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ impl Contract {

let metadata = Metadata::new(
self.metadata_json.take(),
version.default.clone(),
version.long.clone(),
version.l2_revision.clone(),
semver::Version::parse(env!("CARGO_PKG_VERSION")).expect("Always valid"),
optimizer.settings().to_owned(),
);
let metadata_json = serde_json::to_value(&metadata).expect("Always valid");
Expand Down

0 comments on commit 9267a2a

Please sign in to comment.