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

Adjust automation time slot #431

Merged
merged 7 commits into from
Sep 22, 2023
Merged

Adjust automation time slot #431

merged 7 commits into from
Sep 22, 2023

Conversation

imstar15
Copy link
Member

@imstar15 imstar15 commented Sep 18, 2023

Screenshot

image image image

Test

running 120 tests
test autocompounding::tests::test_6 ... ok
test autocompounding::tests::test_5 ... ok
test autocompounding::tests::test_3 ... ok
test autocompounding::tests::test_2 ... ok
test autocompounding::tests::test_1 ... ok
test autocompounding::tests::test_9 ... ok
test autocompounding::tests::test_7 ... ok
test autocompounding::tests::test_4 ... ok
test autocompounding::tests::test_8 ... ok
test benchmarking::bench_run_dynamic_dispatch_action ... ok
test benchmarking::bench_run_dynamic_dispatch_action_fail_decode ... ok
test benchmarking::bench_force_cancel_scheduled_task ... ok
test benchmarking::bench_cancel_scheduled_task_full ... ok
test benchmarking::bench_run_missed_tasks_many_found ... ok
test benchmarking::bench_run_auto_compound_delegated_stake_task ... ok
test benchmarking::bench_force_cancel_scheduled_task_full ... ok
test benchmarking::bench_append_to_missed_tasks ... ok
test benchmarking::bench_run_tasks_many_missing ... ok
test benchmarking::bench_run_missed_tasks_many_missing ... ok
test benchmarking::bench_run_tasks_many_found ... ok
test benchmarking::bench_run_xcmp_task ... ok
test benchmarking::bench_schedule_auto_compound_delegated_stake_task_full ... ok
test benchmarking::bench_update_task_queue_overhead ... ok
test fees::tests::does_not_charge_fees_when_prereq_errors ... ok
test benchmarking::bench_shift_missed_tasks ... ok
test benchmarking::bench_update_scheduled_task_queue ... ok
test fees::tests::errors_when_not_enough_funds_for_fee ... ok
test mock::__construct_runtime_integrity_test::runtime_integrity_tests ... ok
test fees::tests::pay_checked_fees_for_success ... ok
test tests::auto_compound_delegated_stake_enough_balance_no_delegation ... ok
test benchmarking::bench_schedule_dynamic_dispatch_task ... ok
test tests::auto_compound_delegated_stake_enough_balance_no_delegator ... ok
test benchmarking::bench_schedule_dynamic_dispatch_task_full ... ok
test tests::calculate_dynamic_dispatch_action_schedule_fee_amount_works ... ok
test tests::calculate_auto_compound_action_schedule_fee_amount_works ... ok
test tests::auto_compound_delegated_stake_enough_balance_has_delegation ... ok
test tests::auto_compound_delegated_stake_not_enough_balance_has_delegation ... ok
test tests::calculate_xcmp_action_schedule_fee_amount_with_different_destination_returns_same_result ... ok
test tests::calculate_xcmp_action_schedule_fee_amount_with_different_execution_fee_returns_same_result ... ok
test tests::calculate_xcmp_action_schedule_fee_amount_with_different_instruction_sequence_returns_same_result ... ok
test tests::auto_compound_delegated_stake_not_enough_balance_no_delegation ... ok
test tests::calculate_xcmp_action_schedule_fee_amount_with_different_schedule_as_returns_same_result ... ok
test tests::calculate_xcmp_action_schedule_fee_amount_with_absolute_or_relative_native_schedule_fee_works ... ok
test benchmarking::bench_schedule_xcmp_task_full ... ok
test tests::calculate_xcmp_action_schedule_fee_amount_with_different_schedule_fees_works ... ok
test tests::calculate_xcmp_action_schedule_fee_amount_works ... ok
test tests::calculate_xcmp_action_schedule_fee_amount_with_unknown_schedule_fees_fails ... ok
test tests::cancel_task_must_exist ... ok
test tests::cancel_task_not_found ... ok
test tests::cancel_works_for_an_executed_task ... ok
test tests::cancel_works_for_tasks_in_queue ... ok
test tests::cancel_works_for_fixed_scheduled ... ok
test tests::cancel_task_fail_non_owner ... ok
test tests::cancel_works_for_multiple_executions_scheduled ... ok
test tests::extrinsics::schedule_dynamic_dispatch_task::works ... ok
test tests::missed_tasks_removes_completed_tasks ... ok
test tests::cancel_works_for_recurring_scheduled ... ok
test tests::missed_tasks_updates_executions_left ... ok
test tests::get_auto_compound_delegated_stake_task_ids_return_only_auto_compount_task_id ... ok
test tests::force_cancel_task_works ... ok
test tests::run_dynamic_dispatch_action::call_errors ... ok
test tests::on_init_shutdown ... ok
test tests::run_dynamic_dispatch_action::cannot_decode ... ok
test tests::on_init_runs_tasks ... ok
test tests::on_init_check_task_queue ... ok
test tests::run_dynamic_dispatch_action::call_filtered ... ok
test tests::run_dynamic_dispatch_action::call_works ... ok
test tests::schedule_auto_compound_delegated_stake ... ok
test tests::schedule_auto_compound_with_high_frequency ... ok
test tests::schedule_invalid_time_fixed_schedule ... ok
test tests::schedule_invalid_time_recurring_schedule ... ok
test tests::schedule_auto_compound_with_bad_frequency_or_execution_time ... ok
test tests::schedule_not_enough_for_fees ... ok
test tests::schedule_duplicates_errors ... ok
test tests::schedule_max_execution_times_errors ... ok
test tests::schedule_past_time_recurring ... ok
test tests::schedule_execution_times_removes_dupes ... ok
test tests::schedule_past_time ... ok
test tests::schedule_too_far_out ... ok
test tests::schedule_time_slot_full ... ok
test tests::schedule_transfer_with_dynamic_dispatch ... ok
test tests::schedule_xcmp_fails_if_not_enough_funds ... ok
test tests::schedule_time_slot_full_rolls_back ... ok
test tests::schedule_xcmp_through_proxy_same_as_delegator_account ... ok
test tests::schedule_xcmp_through_proxy_works ... ok
test tests::schedule_xcmp_works ... ok
test tests::taskid_adjusted_on_eventindex_on_same_block_from_same_caller ... ok
test tests::taskid_adjusted_on_extrinsicid_on_same_block ... ok
test tests::trigger_tasks_completes_all_tasks ... ok
test tests::trigger_tasks_completes_all_missed_tasks ... ok
test tests::taskid_on_same_extrinsid_have_unique_event_index ... ok
test tests::trigger_tasks_completes_auto_compound_delegated_stake_task ... ok
test tests::taskid_changed_per_block ... ok
test tests::trigger_tasks_handles_nonexisting_tasks ... ok
test tests::trigger_tasks_completes_some_tasks ... ok
test tests::trigger_tasks_completes_some_xcmp_tasks ... ok
test tests::trigger_tasks_handles_first_run ... ok
test tests::trigger_tasks_nothing_to_do ... ok
test tests::trigger_tasks_updates_executions_left ... ok
test tests::trigger_tasks_removes_completed_tasks ... ok
test tests::trigger_tasks_handles_missed_slots ... ok
test types::tests::schedule::checks_for_recurring_schedule_validity ... ok
test tests::trigger_tasks_updates_queues ... ok
test types::tests::schedule::checks_for_fixed_schedule_validity ... ok
test tests::will_not_emit_task_completed_event_when_task_canceled ... ok
test types::tests::schedule::new_fixed_schedule_cleans_execution_times ... ok
test types::tests::schedule::new_fixed_schedule_sets_executions_left ... ok
test types::tests::schedule::number_of_known_executions_for_fixed ... ok
test types::tests::schedule::new_fixed_schedule_errors_with_too_many_executions ... ok
test tests::will_emit_task_completed_event_when_task_completed ... ok
test types::tests::schedule_param::counts_executions ... ok
test types::tests::schedule::number_of_known_executions_for_recurring ... ok
test tests::will_emit_task_completed_event_when_task_failed ... ok
test types::tests::schedule_param::validates_fixed_schedule ... ok
test tests::trigger_tasks_limits_missed_slots ... ok
test types::tests::schedule_param::sets_executions_left ... ok
test types::tests::scheduled_tasks::try_push_works_when_slot_is_not_full ... ok
test types::tests::scheduled_tasks::try_push_errors_when_slot_is_full_by_task_count ... ok
test types::tests::scheduled_tasks::try_push_errors_when_slot_is_full_by_weight ... ok
test types::tests::schedule_param::validates_recurring_schedule ... ok

@imstar15 imstar15 requested a review from chrisli30 September 18, 2023 15:50
@imstar15 imstar15 marked this pull request as draft September 18, 2023 15:51
@imstar15 imstar15 marked this pull request as ready for review September 21, 2023 12:24
@imstar15 imstar15 requested a review from v9n September 21, 2023 12:24
pub const MaxWeightPerSlot: u128 = 700_000_000;
pub const XmpFee: u128 = 1_000_000;
pub const GetNativeCurrencyId: CurrencyId = NATIVE;
}
Copy link
Member

Choose a reason for hiding this comment

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

There are two parameter_types! blocks before impl pallet_automation_time::Config for Test {, so I merged them.

#[derive(Debug)]
pub const MaxExecutionTimes: u32 = 3;
pub const MaxScheduleSeconds: u64 = 86_400; // 24 hours in seconds
pub const SlotSizeSeconds: u64 = 600; // 10 minutes in seconds;
Copy link
Member

Choose a reason for hiding this comment

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

Added const value for SlotSizeSeconds here for test config.

@@ -41,7 +41,9 @@ use xcm::latest::{prelude::*, Junction::Parachain, MultiLocation};
use pallet_valve::Shutdown;

pub const START_BLOCK_TIME: u64 = 33198768000 * 1_000;
pub const SCHEDULED_TIME: u64 = START_BLOCK_TIME / 1_000 + 7200;
const MAX_SCHEDULE_SECONDS: u64 = <Test as Config>::MaxScheduleSeconds::get();
pub const SLOT_SIZE_SECONDS: u64 = <Test as Config>::SlotSizeSeconds::get();
Copy link
Member

Choose a reason for hiding this comment

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

Read Test Config and assign the config values to const variables to share among functions in this file.

@@ -1009,11 +1011,11 @@ fn schedule_auto_compound_with_bad_frequency_or_execution_time() {
// when schedule auto compound task, if the schedule time falls too far in the
// future, return TimeTooFarOut error
#[test]
fn schedule_auto_compound_with_high_frequency() {
fn schedule_auto_compound_with_time_too_far_out() {
Copy link
Member

Choose a reason for hiding this comment

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

This function name was different from its description and implementation.

@@ -349,7 +349,7 @@ mod tests {
use super::*;
use crate::{
mock::*,
tests::{SCHEDULED_TIME, START_BLOCK_TIME},
tests::{SCHEDULED_TIME, SLOT_SIZE_SECONDS, START_BLOCK_TIME},
Copy link
Member

Choose a reason for hiding this comment

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

import the const variable read from Test Config, from tests.rs to types.rs.

@chrisli30
Copy link
Member

I have run the below three commands in order,
cargo +nightly fmt,
cargo test --workspace --all-features,
and cargo build --release --features turing-node --features dev-queue

@imstar15 could you help take another look to see if the config values are correct for both Test and Runtime environments?

@imstar15 imstar15 merged commit 771c9c1 into master Sep 22, 2023
@imstar15 imstar15 deleted the adjust-automation-time-slot branch September 22, 2023 05:30
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.

2 participants