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

Feature: Seconds Precision Timestamp Update #1672

Merged
merged 12 commits into from
Jan 11, 2024

Conversation

talekhinezh
Copy link
Member

Updated logic of consensus manager methods to include seconds precision.
Added StateUpdates generator for substate flashing of the Seconds Precision Timestamp Update to be used with flash transactions.

Copy link

github-actions bot commented Jan 8, 2024

Benchmark for e07bf32

Click to view benchmark
Test Base PR %
costing::bench_prepare_wasm 62.7±0.19ms 62.7±0.26ms 0.00%
costing::decode_sbor 13.1±0.02µs 13.1±0.03µs 0.00%
costing::decode_sbor_bytes 35.6±0.04µs 36.7±0.05µs +3.09%
costing::deserialize_wasm 1240.6±3.61µs 1265.9±1.43µs +2.04%
costing::instantiate_flash_loan 3.8±0.42ms 3.7±0.31ms -2.63%
costing::instantiate_radiswap 5.0±0.05ms 5.0±0.06ms 0.00%
costing::spin_loop 22.5±0.01ms 21.3±0.01ms -5.33%
costing::validate_sbor_payload 26.7±0.02µs 26.6±0.02µs -0.37%
costing::validate_sbor_payload_bytes 368.8±0.24ns 370.5±0.28ns +0.46%
costing::validate_secp256k1 80.2±0.04µs 80.3±0.07µs +0.12%
costing::validate_wasm 34.7±0.03ms 34.5±0.03ms -0.58%
decimal::add/0 7.2±0.00ns 7.2±0.00ns 0.00%
decimal::add/rust-native 9.5±0.00ns 9.5±0.00ns 0.00%
decimal::add/wasmer 136.7±0.32ns 136.6±0.04ns -0.07%
decimal::add/wasmer-call-native 522.4±0.13ns 517.6±0.48ns -0.92%
decimal::add/wasmi 441.4±0.09ns 447.2±0.44ns +1.31%
decimal::add/wasmi-call-native 3.4±0.01µs 3.5±0.01µs +2.94%
decimal::div/0 165.0±0.09ns 166.6±0.12ns +0.97%
decimal::from_string/0 153.9±0.09ns 153.2±0.09ns -0.45%
decimal::mul/0 127.8±0.09ns 129.6±0.06ns +1.41%
decimal::mul/rust-native 131.6±0.08ns 131.8±0.12ns +0.15%
decimal::mul/wasmer 1740.8±0.47ns 1752.3±0.36ns +0.66%
decimal::mul/wasmer-call-native 645.4±0.10ns 647.9±0.44ns +0.39%
decimal::mul/wasmi 26.9±0.02µs 27.8±0.05µs +3.35%
decimal::mul/wasmi-call-native 3.6±0.01µs 3.6±0.01µs 0.00%
decimal::pow/0 621.6±0.21ns 621.8±0.26ns +0.03%
decimal::pow/rust-native 607.3±0.19ns 608.1±0.30ns +0.13%
decimal::pow/wasmer 7.5±0.00µs 7.7±0.00µs +2.67%
decimal::pow/wasmer-call-native 1071.7±0.35ns 1066.7±0.18ns -0.47%
decimal::pow/wasmi 127.2±0.03µs 133.1±0.15µs +4.64%
decimal::pow/wasmi-call-native 3.5±0.01µs 3.5±0.02µs 0.00%
decimal::root/0 9.1±0.00µs 9.1±0.00µs 0.00%
decimal::sub/0 7.2±0.00ns 7.2±0.00ns 0.00%
decimal::to_string/0 497.2±0.19ns 494.2±0.50ns -0.60%
precise_decimal::add/0 8.0±0.00ns 8.7±0.00ns +8.75%
precise_decimal::add/rust-native 10.4±0.02ns 10.4±0.04ns 0.00%
precise_decimal::add/wasmer 140.2±0.03ns 141.7±0.06ns +1.07%
precise_decimal::add/wasmer-call-native 532.4±0.13ns 537.5±0.58ns +0.96%
precise_decimal::add/wasmi 527.2±0.07ns 546.3±1.32ns +3.62%
precise_decimal::add/wasmi-call-native 3.7±0.02µs 3.9±0.02µs +5.41%
precise_decimal::div/0 263.1±0.07ns 263.5±0.18ns +0.15%
precise_decimal::from_string/0 195.9±0.65ns 197.6±0.07ns +0.87%
precise_decimal::mul/0 281.3±0.17ns 280.0±0.34ns -0.46%
precise_decimal::mul/rust-native 263.8±0.28ns 261.7±0.16ns -0.80%
precise_decimal::mul/wasmer 4.0±0.00µs 4.1±0.00µs +2.50%
precise_decimal::mul/wasmer-call-native 826.1±0.25ns 819.8±0.19ns -0.76%
precise_decimal::mul/wasmi 74.0±0.03µs 75.8±0.02µs +2.43%
precise_decimal::mul/wasmi-call-native 4.1±0.02µs 4.1±0.04µs 0.00%
precise_decimal::pow/0 1596.1±0.39ns 1594.3±0.22ns -0.11%
precise_decimal::pow/rust-native 1292.9±0.26ns 1272.3±0.59ns -1.59%
precise_decimal::pow/wasmer 19.0±0.01µs 18.9±0.01µs -0.53%
precise_decimal::pow/wasmer-call-native 2.0±0.00µs 2.0±0.00µs 0.00%
precise_decimal::pow/wasmi 356.2±0.10µs 366.3±0.19µs +2.84%
precise_decimal::pow/wasmi-call-native 7.6±0.03µs 7.9±0.03µs +3.95%
precise_decimal::root/0 62.1±0.02µs 61.1±0.01µs -1.61%
precise_decimal::sub/0 8.3±0.00ns 8.9±0.01ns +7.23%
precise_decimal::to_string/0 751.1±0.23ns 752.6±0.24ns +0.20%
schema::validate_payload 325.4±0.39µs 332.3±0.31µs +2.12%
transaction::radiswap 5.2±0.04ms 5.1±0.04ms -1.92%
transaction::transfer 1682.6±2.78µs 1681.6±4.40µs -0.06%
transaction_processing::prepare 2.4±0.00ms 2.4±0.00ms 0.00%
transaction_processing::prepare_and_decompile 6.1±0.01ms 6.1±0.01ms 0.00%
transaction_processing::prepare_and_decompile_and_recompile 22.3±0.05ms 22.4±0.06ms +0.45%
transaction_validation::validate_manifest 43.9±0.06µs 43.8±0.13µs -0.23%
transaction_validation::verify_ecdsa 77.9±0.21µs 78.0±0.90µs +0.13%
transaction_validation::verify_ed25519 51.4±0.08µs 51.5±0.04µs +0.19%

@talekhinezh talekhinezh force-pushed the feature/timestamp-seconds branch from c0d6b57 to 869f37e Compare January 8, 2024 22:09
@@ -40,7 +40,7 @@ impl ShowLedger {
)
.map_err(Error::IOError)?;

let instant = Self::get_current_time(out, TimePrecision::Minute)?;
let instant = Self::get_current_time(out, TimePrecisionV1::Minute)?;
Copy link
Member

Choose a reason for hiding this comment

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

How about we make committing the state changes from generate_seconds_precision_state_updates part of the simulator's bootstrap process? This is not just important for people running the show-ledger command but for users who're relying on second precision and running their blueprints in the simulator.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hrm, was thinking of updating resim at a later PR so that users don't build against interfaces which don't exist on ledger yet but I think that might be fine so will implement your updates

Copy link
Member

Choose a reason for hiding this comment

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

I think that if we plan on releasing a new version of Scrypto on the day of the protocol update then it would be fine if resim was updated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Running into some issues right now with getting this implemented. As discussed with @0xOmarA , he will create a follow-up PR fixing resim.

scrypto-unit/src/test_runner.rs Show resolved Hide resolved
@@ -222,7 +239,14 @@ pub const CONSENSUS_MANAGER_COMPARE_CURRENT_TIME_IDENT: &str = "compare_current_
#[derive(Debug, Clone, Eq, PartialEq, ScryptoSbor)]
pub struct ConsensusManagerCompareCurrentTimeInput {
Copy link
Member

Choose a reason for hiding this comment

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

For consistency, can this be ConsensusManagerCompareCurrentTimeInputV1?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch

Copy link
Member Author

Choose a reason for hiding this comment

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

Tried to use ConsensusManagerCompareCurrentTimeInputV1 but it's failing tests for some reason. Will come back to this in another PR.

Copy link
Member

Choose a reason for hiding this comment

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

No worries, sounds good.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, as discussed with @0xOmarA , he will follow up with a cleanup PR on this.

@talekhinezh talekhinezh force-pushed the feature/timestamp-seconds branch 2 times, most recently from 98f42d0 to f92f643 Compare January 11, 2024 08:23
@talekhinezh talekhinezh merged commit 079bb8b into develop Jan 11, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants