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

Add TransactionPayloadInner to TransactionPayload #16012

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

Conversation

vusirikala
Copy link
Contributor

Description

How Has This Been Tested?

Key Areas to Review

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Move Compiler
  • Other (specify)

Checklist

  • I have read and followed the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I identified and added all stakeholders and component owners affected by this change as reviewers
  • I tested both happy and unhappy path of the functionality
  • I have made corresponding changes to the documentation

Copy link

trunk-io bot commented Feb 27, 2025

⏱️ 28m total CI duration on this PR
Job Cumulative Duration Recent Runs
check-dynamic-deps 13m 🟩🟩🟩🟩🟩 (+1 more)
rust-cargo-deny 9m 🟩🟩🟩🟩🟥 (+1 more)
general-lints 3m 🟩🟩🟩🟩🟩 (+1 more)
semgrep/ci 2m 🟩🟩🟩🟩🟩 (+1 more)
file_change_determinator 1m 🟩🟩🟩🟩🟩 (+1 more)
permission-check 13s 🟩🟩🟩🟩🟩 (+1 more)
permission-check 13s 🟩🟩🟩🟩🟩 (+1 more)
check-branch-prefix 1s 🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link
Contributor Author

vusirikala commented Feb 27, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vusirikala vusirikala requested review from igor-aptos and removed request for georgemitenkov and movekevin February 27, 2025 08:42
@vusirikala vusirikala force-pushed the satya/orderless_pr_rename branch from 77eba8c to 71dd506 Compare February 28, 2025 07:55
@vusirikala vusirikala changed the title Rename TransactionPayload to TransactionPayloadWrapper Add TransactionPayloadInner to TransactionPayload Feb 28, 2025
@vusirikala vusirikala force-pushed the satya/orderless_pr_rename branch 3 times, most recently from 3d76266 to 7d1d1dc Compare March 3, 2025 16:15
/// A new transaction payload format with support for versioning.
/// Contains an executable (script/entry function) along with extra configuration.
/// Once this new format is fully rolled out, above payload variants will be deprecated.
Payload(TransactionPayloadInner),
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for my ignorance (I known there has been much discussion), but why didn't we instead change the outer Transaction type and add Transaction::UserTransactionV2(SignedUserTxnEnum)? Is it that we assume that will impose more changes across the board?

A fn Transaction::get_user_transaction() -> Option<SignedUserTxnEnum> can convert the old SignedTransaction to SignedUserTxnEnum::Legacy(SignedUserTransaction), for example, so that we don't need to deal with the difference between the new and old format everywhere.

}
}

pub fn payload_type(&self) -> String {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe use Cow<'static, str>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why is Cow<'static, str> better here?

Copy link
Contributor

Choose a reason for hiding this comment

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

So that we don't need to allocate memory every time we return "Multisig::unknown".to_string()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

ContractAddress(*module_id.address())
}
},
_ => Others,
Copy link
Contributor

Choose a reason for hiding this comment

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

let's try not to add blanket match -- in case you add new variants to enums and you miss updating one of the matches.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

TransactionPayload::Multisig(_) => "multisig".to_string(),
TransactionPayload::Payload(TransactionPayloadInner::V1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we add a .get_executable() -> TransactionExecutable so that we don't need to repeat ourselves in all the matches?

(or TransactionExecutableRef<'a>)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -43,6 +43,7 @@ impl UseCaseAwareTransaction for SignedTransaction {
use UseCaseKey::*;

match self.payload() {
// Question: MultiSig contains an entry function too. Why isn't it handled like the entry function?
Copy link
Contributor

Choose a reason for hiding this comment

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

https://aptos-org.slack.com/archives/C03N83P7QUC/p1707765924508469

the multisig payload can carry None (and IIUC it's pretty likely), so I chose to take the easy way.. -_-

@@ -33,6 +34,16 @@ impl Multisig {
),
}
}

pub fn as_transaction_executable(&self) -> TransactionExecutable {
// TODO: See how to avoid cloning the entry function here.
Copy link
Contributor

Choose a reason for hiding this comment

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

do TransactionExecutableRef<'a>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@vusirikala vusirikala force-pushed the satya/orderless_pr_rename branch 7 times, most recently from c08e3d6 to be2f08c Compare March 11, 2025 22:28
@vusirikala vusirikala force-pushed the satya/orderless_pr_rename branch from be2f08c to a98b1e0 Compare March 11, 2025 23:28
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