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

Pick feature reconfigure changes #8998

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn generate_consensus_upgrade_proposal(
&writer,
is_testnet,
next_execution_hash.clone(),
"aptos_framework::consensus_config",
&["aptos_framework::consensus_config"],
|writer| {
let consensus_config_blob = bcs::to_bytes(consensus_config).unwrap();
assert!(consensus_config_blob.len() < 65536);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn generate_execution_config_upgrade_proposal(
&writer,
is_testnet,
next_execution_hash.clone(),
"aptos_framework::execution_config",
&["aptos_framework::execution_config"],
|writer| {
let execution_config_blob = bcs::to_bytes(execution_config).unwrap();
assert!(execution_config_blob.len() < 65536);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub fn generate_feature_upgrade_proposal(
&writer,
is_testnet,
next_execution_hash.clone(),
"std::features",
&["std::features"],
|writer| {
emit!(writer, "let enabled_blob: vector<u64> = ");
generate_features_blob(writer, &enabled);
Expand All @@ -106,11 +106,13 @@ pub fn generate_feature_upgrade_proposal(
writer,
"features::change_feature_flags(framework_signer, enabled_blob, disabled_blob);"
);
emitln!(writer, "aptos_governance::reconfigure(framework_signer);");
} else {
emitln!(
writer,
"features::change_feature_flags(&framework_signer, enabled_blob, disabled_blob);"
);
emitln!(writer, "aptos_governance::reconfigure(&framework_signer);");
}
},
);
Expand Down
2 changes: 1 addition & 1 deletion aptos-move/aptos-release-builder/src/components/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub fn generate_gas_upgrade_proposal(
&writer,
is_testnet,
next_execution_hash.clone(),
"aptos_framework::gas_schedule",
&["aptos_framework::gas_schedule"],
|writer| {
let gas_schedule_blob = bcs::to_bytes(gas_schedule).unwrap();
assert!(gas_schedule_blob.len() < 65536);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn generate_fee_distribution_proposal(
&writer,
is_testnet,
next_execution_hash,
"aptos_framework::transaction_fee",
&["aptos_framework::transaction_fee"],
|writer| {
emitln!(
writer,
Expand Down
2 changes: 1 addition & 1 deletion aptos-move/aptos-release-builder/src/components/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn generate_version_upgrade_proposal(
&writer,
is_testnet,
next_execution_hash.clone(),
"aptos_framework::version",
&["aptos_framework::version"],
|writer| {
if is_testnet && next_execution_hash.is_empty() {
emitln!(
Expand Down
20 changes: 12 additions & 8 deletions aptos-move/aptos-release-builder/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,17 @@ pub(crate) fn generate_next_execution_hash_blob(

pub(crate) fn generate_governance_proposal_header(
writer: &CodeWriter,
deps_name: &str,
deps_names: &[&str],
is_multi_step: bool,
next_execution_hash: Vec<u8>,
) {
emitln!(writer, "script {");
writer.indent();

emitln!(writer, "use aptos_framework::aptos_governance;");
emitln!(writer, "use {};", deps_name);
for deps_name in deps_names {
emitln!(writer, "use {};", deps_name);
}
if next_execution_hash == "vector::empty<u8>()".as_bytes() {
emitln!(writer, "use std::vector;");
}
Expand All @@ -83,12 +85,14 @@ pub(crate) fn generate_governance_proposal_header(
}
}

pub(crate) fn generate_testnet_header(writer: &CodeWriter, deps_name: &str) {
pub(crate) fn generate_testnet_header(writer: &CodeWriter, deps_names: &[&str]) {
emitln!(writer, "script {");
writer.indent();

emitln!(writer, "use aptos_framework::aptos_governance;");
emitln!(writer, "use {};", deps_name);
for deps_name in deps_names {
emitln!(writer, "use {};", deps_name);
}
emitln!(writer);

emitln!(writer, "fun main(core_resources: &signer) {");
Expand Down Expand Up @@ -116,25 +120,25 @@ pub(crate) fn generate_governance_proposal<F>(
writer: &CodeWriter,
is_testnet: bool,
next_execution_hash: Vec<u8>,
deps_name: &str,
deps_names: &[&str],
body: F,
) -> String
where
F: FnOnce(&CodeWriter),
{
if next_execution_hash.is_empty() {
if is_testnet {
generate_testnet_header(writer, deps_name);
generate_testnet_header(writer, deps_names);
} else {
generate_governance_proposal_header(
writer,
deps_name,
deps_names,
false,
"".to_owned().into_bytes(),
);
}
} else {
generate_governance_proposal_header(writer, deps_name, true, next_execution_hash);
generate_governance_proposal_header(writer, deps_names, true, next_execution_hash);
};

body(writer);
Expand Down