-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
base: main
Are you sure you want to change the base?
Conversation
⏱️ 28m total CI duration on this PR
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
77eba8c
to
71dd506
Compare
3d76266
to
7d1d1dc
Compare
/// 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), |
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.
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.
types/src/transaction/mod.rs
Outdated
} | ||
} | ||
|
||
pub fn payload_type(&self) -> String { |
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.
nit: maybe use Cow<'static, str>
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.
Why is Cow<'static, str>
better here?
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.
So that we don't need to allocate memory every time we return "Multisig::unknown".to_string()
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.
Done.
ContractAddress(*module_id.address()) | ||
} | ||
}, | ||
_ => Others, |
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.
let's try not to add blanket match -- in case you add new variants to enums and you miss updating one of the matches.
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.
Done.
TransactionPayload::Multisig(_) => "multisig".to_string(), | ||
TransactionPayload::Payload(TransactionPayloadInner::V1 { |
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.
Shall we add a .get_executable() -> TransactionExecutable
so that we don't need to repeat ourselves in all the matches?
(or TransactionExecutableRef<'a>
)
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.
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? |
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.
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.. -_-
types/src/transaction/multisig.rs
Outdated
@@ -33,6 +34,16 @@ impl Multisig { | |||
), | |||
} | |||
} | |||
|
|||
pub fn as_transaction_executable(&self) -> TransactionExecutable { | |||
// TODO: See how to avoid cloning the entry function here. |
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.
do TransactionExecutableRef<'a>
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.
Done.
c08e3d6
to
be2f08c
Compare
be2f08c
to
a98b1e0
Compare
Description
How Has This Been Tested?
Key Areas to Review
Type of Change
Which Components or Systems Does This Change Impact?
Checklist