-
Notifications
You must be signed in to change notification settings - Fork 2
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-1346] Implemented custom handling of automation transaction #134
Conversation
f3cea7a
to
6bc98a0
Compare
6bc98a0
to
61a72a2
Compare
consensus/src/transaction_shuffler/fairness/conflict_key/entry_fun.rs
Outdated
Show resolved
Hide resolved
consensus/src/transaction_shuffler/fairness/conflict_key/entry_fun_module.rs
Outdated
Show resolved
Hide resolved
61a72a2
to
71c43e9
Compare
26bc075
to
2392127
Compare
40bbb05
to
7c1f122
Compare
2392127
to
d737095
Compare
c63bb23
to
87dab4b
Compare
@@ -56,6 +58,7 @@ pub(crate) fn validate_view_function( | |||
let allowed_structs = get_allowed_structs(struct_constructors_feature); | |||
let args = transaction_arg_validation::construct_args( | |||
session, | |||
&mut UnmeteredGasMeter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
View functions are typically not charged any gas on their own (unless called from some entry function). I am hoping the metering would not change that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously construct_args where not directly accepting gas-meter as argument, but it was creating UnmeteredGasMeter
internally to do the construction. But as long as we wanted to charge for AutomationTransaction
embedded payload validation, I have updated the functions to accept gas-meter as input. So here specifying UnbeteredGasMeter
does not affect affect original view-function economy and no charges will be applied.
aptos-move/e2e-tests/src/executor.rs
Outdated
TransactionPayload::Automation(auto_payload) => GasProfiler::new_function( | ||
gas_meter, | ||
auto_payload.module_id().clone(), | ||
auto_payload.function().to_owned(), | ||
auto_payload.ty_args().to_vec(), | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this here for gas estimation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think so. GasProfiler
simply records gas-cost for predefined set of operations along with gas-cost calculation based on specified meter, and mainly utilized in aptos-debuger
and here in FakeExecutor
for e2e tests
aptos-move/framework/supra-framework/sources/automation_registry.move
Outdated
Show resolved
Hide resolved
} | ||
} | ||
} | ||
|
||
impl ConflictKey<SignedTransaction> for EntryFunKey { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am unsure of the role of ConflictKey
here for consensus. We can discuss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my understanding it that it is used by aptos-consensus to order/select the transactions while constructing a block to avoid conflicts as much as possible.
Here is the comment for it in code-base
/// `ConflictKey::extract_from(txn)` extracts a key from a transaction. For example,
/// `TxnSenderKey::extract_from(txn)` returns the transaction sender's address. The key is used by
/// the shuffler to determine whether two close by transactions conflict with each other.
///
/// `ConflictKey::conflict_exempt(&key)` returns if this specific key is exempt from conflict.
/// For example, we can exempt transaction sender 0x1, so that consecutive transactions sent by
/// 0x1 are not seen as a conflict by the shuffler.
This feature is used to reorder the existing transactions avoiding conflicts as much as possible and then build the block from the ordered set.
This is aptos internal logic and in smr-moonshot we are not using it.
// Verification errors related to automation transaction | ||
// Automation Transaction payload validation failed. | ||
INVALID_AUTOMATION_PAYLOAD = 1132, | ||
INVALID_AUTOMATION_PAYLOAD_ARGUMENTS = 1133, | ||
INVALID_AUTOMATION_INNER_PAYLOAD = 1134, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lines above mentions RESERVED_VERIFICATION_ERROR_X
, does it mean that this error codes are also referenced/provisioned somewhere else? In which case these new codes would have to be integrated there as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have checked they are not referenced in any other place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has the changes to CLI been added or planned to ensure that CLI/client can make this new transaction type?
That should be done in scope of smr-moonshot a new CLI command should be added to create automtion-transaction. |
87dab4b
to
e1c46bf
Compare
@@ -328,7 +328,7 @@ impl | |||
u64, | |||
), | |||
) -> Self { | |||
// If at some point Aptos will utilize Automation transactions then here we will use as | |||
// If at some point Aptos will utilize Automated transactions then here we will use as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If at some point Aptos will utilize Automated transactions then here we will use as | |
// If at some point Supra will utilize Automated transactions then here we will use as |
@@ -1,6 +1,3 @@ | |||
// Copyright (c) Aptos Foundation | |||
// SPDX-License-Identifier: Apache-2.0 | |||
|
|||
// Copyright (c) 2024 Supra. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Copyright (c) 2024 Supra. | |
// Copyright (c) 2024 Supra. | |
// SPDX-License-Identifier : Apache-2.0 |
- Added separate flow for automation transaction handling. It differes from user transaction flow only by custom validation step of inner-payload of automation transaction - Added validation logic for the automation transaction inner-payload - Introuced specific StatusCode for failures during automation transaction inner-payload validation. They are qualified as verification status type and will lead to have transaction kept and the account will be charged.
- Introduced a new type PayloadTypeReference which will describe user-transaction payload type and reference payload if required. - Updated TransactionMetadata and UserTransctionContext to utilize PayloadTypeReference enabling easy extension of any new payload type when needed - Updated transaction_arg_validation::validate_combine_signer_and_txn_args to accept GasMeter as input argument. - Updated automation inner payload validation to charge gas for it - Added initial set of e2e tests to check Automation transaction flow.
…ng the required arguments for registration
69f54b6
to
7a19798
Compare
3cdbba5
to
6740abf
Compare
…#134) * [AN-Issue-1346] Implemented custom handling of automation transactions - Added separate flow for automation transaction handling. It differes from user transaction flow only by custom validation step of inner-payload of automation transaction - Added validation logic for the automation transaction inner-payload - Introuced specific StatusCode for failures during automation transaction inner-payload validation. They are qualified as verification status type and will lead to have transaction kept and the account will be charged. * Updated copyright info * Added language-e2e-testsuite to ci-flow with fixed tests * Addressed review comments and added tests - Introduced a new type PayloadTypeReference which will describe user-transaction payload type and reference payload if required. - Updated TransactionMetadata and UserTransctionContext to utilize PayloadTypeReference enabling easy extension of any new payload type when needed - Updated transaction_arg_validation::validate_combine_signer_and_txn_args to accept GasMeter as input argument. - Updated automation inner payload validation to charge gas for it - Added initial set of e2e tests to check Automation transaction flow. * Fixed test failures after rebase * Fixed copyright comment * Introduce means to create and process automation transaction specifying the required arguments for registration * Addressed review comments * Renamed 'automation transaction' to 'automation registration' * Updated automation::registry to be non-entry and made direct call from native layer * Cosmetic chagnes * Copyright fix * Temporarly fixed test failure * Split and reordered test runs in ci * Increased nextest timeout from 2100 to 3000 --------- Co-authored-by: Aregnaz Harutyunyan <>
Added separate flow for automation transaction handling. It differes from user transaction flow only by custom validation step of inner-payload of automation transaction
Added validation logic for the automation transaction inner-payload
Introuced specific StatusCode for failures during automation transaction inner-payload validation. They are qualified as verification status type and will lead to have transaction kept and the account will be charged.