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

Fix units in timed feature flags #15391

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

vineethk
Copy link
Contributor

@vineethk vineethk commented Nov 25, 2024

Description

Previously, timed feature flags activation time used millis as the unit, last_reconfiguration_time used micros as the unit, and these two were compared to see if timed feature flag was enabled (which was always true for any date on which blockchain has been around).

  1. This PR fixes the above issue.
  2. We also always enable DisableInvariantViolationCheckInSwapLoc (keeping the same semantics as before, but applying a minor fix).
  3. We remove the replay override for EntryCompatibility (as there are transactions on mainnet before this feature was activated that fail the corresponding check).

How Has This Been Tested?

  • Existing tests
  • Will be running replay-verify
  • Added some new tests

Type of Change

  • Bug fix

Which Components or Systems Does This Change Impact?

  • Validator Node

Copy link

trunk-io bot commented Nov 25, 2024

⏱️ 30m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-move-tests 12m 🟩
rust-move-tests 10m
rust-cargo-deny 3m 🟩🟩
check-dynamic-deps 2m 🟩🟩
general-lints 1m 🟩🟩
semgrep/ci 51s 🟩🟩
file_change_determinator 20s 🟩🟩
permission-check 6s 🟩🟩
permission-check 5s 🟩🟩
check-branch-prefix 1s 🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link
Contributor Author

vineethk commented Nov 25, 2024

Copy link
Contributor

@runtian-zhou runtian-zhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

types/src/on_chain_config/mod.rs Show resolved Hide resolved
types/src/on_chain_config/mod.rs Show resolved Hide resolved
@@ -161,4 +160,86 @@ mod test {
let testing = assert_ok!(bcs::to_bytes(&TimedFeatureOverride::Testing));
assert_ne!(replay, testing);
}

#[test]
fn test_timed_features_activation() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding tests 👍

types/src/on_chain_config/timed_features.rs Show resolved Hide resolved
@@ -84,6 +82,7 @@ pub struct TimedFeaturesBuilder {
}

impl TimedFeaturesBuilder {
/// `timestamp` is a Unix Epoch timestamp in microseconds.
pub fn new(chain_id: ChainId, timestamp: u64) -> Self {
Copy link
Contributor

@georgemitenkov georgemitenkov Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably super nit, but i think you can define a type alias pub type Micros = u64. Then all callers of new(...) have to cast (and therefore think about units)?

another nit: timestamp_micros?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants