Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comments on which semantic ids represent consensus-breaking changes #271

Merged
merged 1 commit into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions RGB_LIB_IDs.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Auto-generated semantic IDs for RGB consensus-critical libraries and their corresponding versions of bitmask-core.

[LIB_ID_RGB]
# Consensus-breaking: If changed, assets must be reissued
memphis_asia_crash_4fGZWR5mH5zZzRZ1r7CSRe776zm3hLBUngfXc4s3vm3V = "0.6.0-rc.6"

[LIB_ID_RGB_CONTRACT]
# Interface-only: If changed, only a new interface implementation is needed. No reiussance or migration necessary.
price_canvas_oliver_9Te5P6nq3oaDHMgttLEbkojbeQPTqqZLhjxZ3my1F8aJ = "0.6.0-rc.6"

[LIB_ID_RGB20]
dragon_table_game_GVz4mvYE94aQ9q2HPtV9VuoppcDdduP54BMKffF7YoFH = "0.6.0-rc.6"

Expand All @@ -12,8 +17,6 @@ benny_horse_salad_E3AsDKsHSqAPQLvJke3DcPrkErbS2Jxf8pQ8jYBQYJPA = "0.6.0-rc.6"
[LIB_ID_RGB25]
ritual_mask_next_4JmGrg7oTgwuCQtyC4ezC38ToHMzgMCVS5kMSDPwo2ee = "0.6.0-rc.6"

[LIB_ID_RGB_CONTRACT]
price_canvas_oliver_9Te5P6nq3oaDHMgttLEbkojbeQPTqqZLhjxZ3my1F8aJ = "0.6.0-rc.6"

[LIB_ID_RGB_STD]
# Not consensus-breaking: If changed, only stash and consignments must be updated. No reiussance or migration necessary.
patent_iris_torch_Firwvn75qng8cm4n7iHXXiFDsG1V476vYGqdfwwFRT1b = "0.6.0-rc.6"
46 changes: 25 additions & 21 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,55 +13,59 @@ type IdVersionMap = BTreeMap<String, String>;
#[derive(Deserialize, Serialize)]
struct LibIds {
LIB_ID_RGB: IdVersionMap,
LIB_ID_RGB_CONTRACT: IdVersionMap,
LIB_ID_RGB20: IdVersionMap,
LIB_ID_RGB21: IdVersionMap,
LIB_ID_RGB25: IdVersionMap,
LIB_ID_RGB_CONTRACT: IdVersionMap,
LIB_ID_RGB_STD: IdVersionMap,
}

const LIB_IDS_FILE: &str = "RGB_LIB_IDs.toml";
const NOTE_COMMENT: &str =
const FILE_COMMENT: &str =
"# Auto-generated semantic IDs for RGB consensus-critical libraries and their corresponding versions of bitmask-core.\n\n";
const LIB_ID_RGB_COMMENT: &str =
"[LIB_ID_RGB]\n# Consensus-breaking: If changed, assets must be reissued";
const LIB_ID_RGB_CONTRACT_COMMENT: &str =
"[LIB_ID_RGB_CONTRACT]\n# Interface-only: If changed, only a new interface implementation is needed. No reiussance or migration necessary.";
const LIB_ID_RGB_STD_COMMENT: &str =
"[LIB_ID_RGB_STD]\n# Not consensus-breaking: If changed, only stash and consignments must be updated. No reiussance or migration necessary.";

fn main() -> Result<()> {
const BMC_VERSION: &str = env!("CARGO_PKG_VERSION");

let lib_ids_file = fs::read_to_string(LIB_IDS_FILE)?;
let mut lib_ids: LibIds = toml::from_str(&lib_ids_file)?;
let toml = fs::read_to_string(LIB_IDS_FILE)?;
let mut doc: LibIds = toml::from_str(&toml)?;

lib_ids
.LIB_ID_RGB
doc.LIB_ID_RGB
.entry(LIB_ID_RGB.to_owned())
.or_insert(BMC_VERSION.to_owned());

lib_ids
.LIB_ID_RGB20
doc.LIB_ID_RGB_CONTRACT
.entry(LIB_ID_RGB_CONTRACT.to_owned())
.or_insert(BMC_VERSION.to_owned());

doc.LIB_ID_RGB20
.entry(LIB_ID_RGB20.to_owned())
.or_insert(BMC_VERSION.to_owned());

lib_ids
.LIB_ID_RGB21
doc.LIB_ID_RGB21
.entry(LIB_ID_RGB21.to_owned())
.or_insert(BMC_VERSION.to_owned());

lib_ids
.LIB_ID_RGB25
doc.LIB_ID_RGB25
.entry(LIB_ID_RGB25.to_owned())
.or_insert(BMC_VERSION.to_owned());

lib_ids
.LIB_ID_RGB_CONTRACT
.entry(LIB_ID_RGB_CONTRACT.to_owned())
.or_insert(BMC_VERSION.to_owned());

lib_ids
.LIB_ID_RGB_STD
doc.LIB_ID_RGB_STD
.entry(LIB_ID_RGB_STD.to_owned())
.or_insert(BMC_VERSION.to_owned());

let toml = toml::to_string(&lib_ids)?;
fs::write(LIB_IDS_FILE, format!("{NOTE_COMMENT}{toml}"))?;
let toml = toml::to_string(&doc)?;
let toml = toml.replace("[LIB_ID_RGB]", LIB_ID_RGB_COMMENT);
let toml = toml.replace("[LIB_ID_RGB_CONTRACT]", LIB_ID_RGB_CONTRACT_COMMENT);
let toml = toml.replace("[LIB_ID_RGB_STD]", LIB_ID_RGB_STD_COMMENT);

fs::write(LIB_IDS_FILE, format!("{FILE_COMMENT}{toml}"))?;

Ok(())
}