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

[AN-Issue-1347] Implemented Automated transaction execution flow #136

Merged
merged 4 commits into from
Dec 30, 2024

Conversation

aregng
Copy link

@aregng aregng commented Dec 11, 2024

No description provided.

Copy link

@sjoshisupra sjoshisupra left a comment

Choose a reason for hiding this comment

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

@aregng , it seems that from the issue 1347 I did not see

  • Chain ID check being done (if it is not done for other tx, we may not do it for automation as well)
  • Check that there is a corresponding active task for this tx (each automation task would have a unique id provided by registry) and sender seems missing. If we assume however that nodes are honest I wonder if this check is required though.

Comment on lines +178 to +189
assert!(
timestamp::now_seconds() < txn_expiration_time,
error::invalid_argument(PROLOGUE_ETRANSACTION_EXPIRED),
);

Choose a reason for hiding this comment

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

I was under the impression that if an automation task is beyond it's expiry, the SMR layer would never include it in the set of tx to be executed. Is that still correct? Because otherwise it would result in continuous failed assert here in the prologue.

Copy link
Author

Choose a reason for hiding this comment

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

That is true, but as mentioned in my previous comment, I think each layer should validate its input and not rely on the other component correctness. If we do not agree with this approach and here we will always assume that input will not be expired, then this check can be removed.

@aregng
Copy link
Author

aregng commented Dec 12, 2024

@aregng , it seems that from the issue 1347 I did not see

  • Chain ID check being done (if it is not done for other tx, we may not do it for automation as well)
  • Check that there is a corresponding active task for this tx (each automation task would have a unique id provided by registry) and sender seems missing. If we assume however that nodes are honest I wonder if this check is required though.
  • ChainID, During pervious discussion it was marked as optional, that's why I have not add it and wanted to clarify one more time. The check is done for user-transaction. So I will add it here as well.
  • Regarding check against registry: As mentioned in the above comment, either we always trust that the input provided by other component can not be incorrect, or each component does some checks on its own as well.
    Can you point where sender is missing ?
    @aregng I am referring to point 3 in prologue requirement of 1347 (https://github.com/Entropy-Foundation/smr-moonshot/issues/1347), I believe it is not checked in the prologue that task-id indeed belong to the sender.

@aregng aregng marked this pull request as ready for review December 17, 2024 16:55
@aregng aregng changed the base branch from task/issue-1346 to task/registry-update-on-new-epoch December 18, 2024 16:18
@aregng aregng force-pushed the task/issue-1347 branch 2 times, most recently from a92b1bd to ace749e Compare December 20, 2024 09:36
@aregng aregng force-pushed the task/registry-update-on-new-epoch branch from ab774df to bc106d9 Compare December 20, 2024 12:32
@@ -188,6 +189,7 @@ module supra_framework::genesis {
reconfiguration::initialize(&supra_framework_account);
block::initialize(&supra_framework_account, epoch_interval_microsecs);
state_storage::initialize(&supra_framework_account);
automation_registry::initialize(&supra_framework_account);

Choose a reason for hiding this comment

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

I don't think we should call this here. Otherwise replay of the chain would not agree on its state. Since we have launched mainnet, this should not be touched now. automation_registry::initialize can be called via governance script (upgrade framework followed by call to initialize)

Copy link
Author

@aregng aregng Dec 23, 2024

Choose a reason for hiding this comment

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

The testing will not be easy if we do not have initialize called here. as during testing we start the chain from genesis.
I remember you once mentioned that you want to avoid conditional initialization, but at this moment I do not see easy way to have the module initialized properly with genesis startup.
Featuer enable/disable interface might be investigated to picture and cover all scenarios.

Copy link
Author

Choose a reason for hiding this comment

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

Mentioned in ticket https://github.com/Entropy-Foundation/smr-moonshot/issues/1422 to be addressed later.

@@ -437,7 +437,8 @@ spec supra_framework::stake {

spec on_new_epoch {
pragma verify = false; // TODO: set because of timeout (property proved).
pragma disable_invariants_in_body;
// TODO: Why we need to disable invariants in body? (SUPRA)

Choose a reason for hiding this comment

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

I think Move prover will fail compilation if we do not have this pragma.

Copy link
Author

Choose a reason for hiding this comment

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

This is not part of my change-set. it comes from this change-set f9652d1

}

/// Add Multiple Keys in the Enumerable Map
public fun add_value_bulk<K: copy+drop, V : store+drop+copy>(

Choose a reason for hiding this comment

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

Just like vector::for_each and vector::for_each_ref, it may be helpful if we add enumerable_map::for_each_value and enumerable_map::for_each_value_ref

Copy link
Author

Choose a reason for hiding this comment

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

Comment on lines 864 to 867
let expiration_timestamp_secs = Some(convert_timestamp_secs(std::cmp::min(
at.meta.expiration_timestamp_secs.0,
chrono::NaiveDateTime::MAX.timestamp() as u64,
)));

Choose a reason for hiding this comment

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

@aregng I am not sure I quite understand what is happening here. min of MAX time and at.meta.expiration_timestamp_secs.0 would always result in at.meta.expiration_timestamp_secs.0, right? Not sure what is happening here.

Copy link
Author

@aregng aregng Dec 23, 2024

Choose a reason for hiding this comment

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

My assumption will be that if user specified timestamp exceeds expected MAX of the chrono::NaiveDateTime::MAX.timestamp() it will take the later one. This part might require revision as AutoamtedTransactions will never be posted by users. I need to spend more time to understand APTOS-API and how it is utilized to make sure that these changes were valid or invalid. But at this moment they do not play any role it the main automation-flow implementation.

chrono uses i64 for timestamp and we use u64 so i64::MAX can be potentially less than u64 value specified for expiration time.

@aregng aregng force-pushed the task/issue-1347 branch 2 times, most recently from 361e3ba to 3e787dc Compare December 24, 2024 09:39
@aregng
Copy link
Author

aregng commented Dec 25, 2024

@aregng , it seems that from the issue 1347 I did not see

  • Chain ID check being done (if it is not done for other tx, we may not do it for automation as well)
  • Check that there is a corresponding active task for this tx (each automation task would have a unique id provided by registry) and sender seems missing. If we assume however that nodes are honest I wonder if this check is required though.
  • ChainID, During pervious discussion it was marked as optional, that's why I have not add it and wanted to clarify one more time. The check is done for user-transaction. So I will add it here as well.
  • Regarding check against registry: As mentioned in the above comment, either we always trust that the input provided by other component can not be incorrect, or each component does some checks on its own as well.
    Can you point where sender is missing ?
    @aregng I am referring to point 3 in prologue requirement of 1347 ([Automation: MoveLayer] Automated transaction prologue/epilogue smr-moonshot#1347), I believe it is not checked in the prologue that task-id indeed belong to the sender.

Addressed, sender check is also added.

@aregng aregng changed the base branch from task/registry-update-on-new-epoch to feature/automation-networks December 25, 2024 16:08
Aregnaz Harutyunyan added 4 commits December 30, 2024 13:41
@aregng aregng merged commit 70f4027 into feature/automation-networks Dec 30, 2024
1 check failed
aregng added a commit that referenced this pull request Jan 15, 2025
* [AN-Issue-1347] Implemented Automated transasction execution flow

* Updated automated task prologue and added e2e tests

- Added chain-id verification and task availability check by task index
- Added e2e tests for AutoamtedTransaction

* Fixed test failure

* Added task sender check in automated_transaction_prologue

---------

Co-authored-by: Aregnaz Harutyunyan <>
aregng added a commit that referenced this pull request Mar 7, 2025
* [AN-Issue-1347] Implemented Automated transasction execution flow

* Updated automated task prologue and added e2e tests

- Added chain-id verification and task availability check by task index
- Added e2e tests for AutoamtedTransaction

* Fixed test failure

* Added task sender check in automated_transaction_prologue

---------

Co-authored-by: Aregnaz Harutyunyan <>
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.

3 participants