Skip to content

Commit fb4109f

Browse files
authored
Merge pull request #136 from movementlabsxyz/l-monninger/fix-movement
fix: use direct set gas schedule on testnet.
2 parents f018a5b + 1389b6a commit fb4109f

File tree

6 files changed

+37
-6
lines changed

6 files changed

+37
-6
lines changed

aptos-move/aptos-release-builder/src/components/feature_flags.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,16 @@ pub fn generate_feature_upgrade_proposal(
185185
generate_features_blob(writer, &disabled);
186186
emitln!(writer, ";\n");
187187

188+
let update_method = if is_testnet {
189+
"change_feature_flags"
190+
} else {
191+
"change_feature_flags_for_next_epoch"
192+
};
193+
188194
emitln!(
189195
writer,
190-
"features::change_feature_flags_for_next_epoch({}, enabled_blob, disabled_blob);",
196+
"features::{}({}, enabled_blob, disabled_blob);",
197+
update_method,
191198
signer_arg
192199
);
193200
emitln!(writer, "aptos_governance::reconfigure({});", signer_arg);

aptos-move/aptos-release-builder/src/components/gas.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,32 @@ pub fn generate_gas_upgrade_proposal(
135135
);
136136
},
137137
None => {
138+
let update_method = if is_testnet {
139+
"set_for_next_epoch"
140+
} else {
141+
"set_for_next_epoch"
142+
};
138143
emitln!(
139144
writer,
140-
"gas_schedule::set_for_next_epoch({}, gas_schedule_blob);",
145+
"gas_schedule::{}({}, gas_schedule_blob);",
146+
update_method,
141147
signer_arg
142148
);
143149
},
144150
}
145-
emitln!(writer, "aptos_governance::reconfigure({});", signer_arg);
151+
152+
let reconfig_method = if is_testnet {
153+
"force_end_epoch"
154+
} else {
155+
"reconfigure"
156+
};
157+
158+
emitln!(
159+
writer,
160+
"aptos_governance::{}({});",
161+
reconfig_method,
162+
signer_arg
163+
);
146164
},
147165
);
148166

aptos-move/framework/aptos-framework/sources/chain_status.move

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ module aptos_framework::chain_status {
4343

4444
/// Helper function to assert genesis state.
4545
public fun assert_genesis() {
46-
assert!(is_genesis(), error::invalid_state(ENOT_OPERATING));
46+
assert!(is_genesis(), error::invalid_state(ENOT_GENESIS));
4747
}
4848
}

aptos-move/framework/move-stdlib/sources/configs/features.move

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,11 @@ module std::features {
636636
///
637637
/// Genesis/tests should use `change_feature_flags_internal()` for feature vec initialization.
638638
///
639+
/// This can be used on testnet prior to successful DKG.
640+
///
639641
/// Governance proposals should use `change_feature_flags_for_next_epoch()` to enable/disable features.
640-
public fun change_feature_flags(_framework: &signer, _enable: vector<u64>, _disable: vector<u64>) {
641-
abort (error::invalid_state(EAPI_DISABLED))
642+
public fun change_feature_flags(framework: &signer, enable: vector<u64>, disable: vector<u64>) acquires Features {
643+
change_feature_flags_internal(framework, enable, disable)
642644
}
643645

644646
/// Update feature flags directly. Only used in genesis/tests.

crates/aptos-jwk-consensus/src/epoch_manager.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ impl<P: OnChainConfigProvider> EpochManager<P> {
148148
}
149149

150150
async fn start_new_epoch(&mut self, payload: OnChainConfigPayload<P>) {
151+
println!("Starting new epoch.");
151152
let validator_set: ValidatorSet = payload
152153
.get()
153154
.expect("failed to get ValidatorSet from payload");
@@ -239,6 +240,7 @@ impl<P: OnChainConfigProvider> EpochManager<P> {
239240
}
240241

241242
async fn on_new_epoch(&mut self, reconfig_notification: ReconfigNotification<P>) -> Result<()> {
243+
println!("EpochManager received new epoch notification.");
242244
self.shutdown_current_processor().await;
243245
self.start_new_epoch(reconfig_notification.on_chain_configs)
244246
.await;

dkg/src/epoch_manager.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ impl<P: OnChainConfigProvider> EpochManager<P> {
152152
}
153153

154154
async fn start_new_epoch(&mut self, payload: OnChainConfigPayload<P>) {
155+
println!("Starting new epoch.");
155156
let validator_set: ValidatorSet = payload
156157
.get()
157158
.expect("failed to get ValidatorSet from payload");
@@ -250,6 +251,7 @@ impl<P: OnChainConfigProvider> EpochManager<P> {
250251
}
251252

252253
async fn on_new_epoch(&mut self, reconfig_notification: ReconfigNotification<P>) -> Result<()> {
254+
println!("EpochManager received new epoch notification.");
253255
self.shutdown_current_processor().await;
254256
self.start_new_epoch(reconfig_notification.on_chain_configs)
255257
.await;

0 commit comments

Comments
 (0)