sui_sdk_types/transaction/mod.rs
1use crate::Digest;
2
3use super::Address;
4use super::CheckpointTimestamp;
5use super::EpochId;
6use super::GenesisObject;
7use super::Identifier;
8use super::Jwk;
9use super::JwkId;
10use super::ObjectReference;
11use super::ProtocolVersion;
12use super::TypeTag;
13use super::UserSignature;
14use super::Version;
15
16#[cfg(feature = "serde")]
17#[cfg_attr(doc_cfg, doc(cfg(feature = "serde")))]
18mod serialization;
19#[cfg(feature = "serde")]
20#[cfg_attr(doc_cfg, doc(cfg(feature = "serde")))]
21pub(crate) use serialization::SignedTransactionWithIntentMessage;
22
23/// A transaction
24///
25/// # BCS
26///
27/// The BCS serialized form for this type is defined by the following ABNF:
28///
29/// ```text
30/// transaction = %x00 transaction-v1
31///
32/// transaction-v1 = transaction-kind address gas-payment transaction-expiration
33/// ```
34#[derive(Clone, Debug, PartialEq, Eq)]
35#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
36pub struct Transaction {
37 pub kind: TransactionKind,
38 pub sender: Address,
39 pub gas_payment: GasPayment,
40 pub expiration: TransactionExpiration,
41}
42
43#[derive(Clone, Debug, PartialEq, Eq)]
44#[cfg_attr(
45 feature = "serde",
46 derive(serde_derive::Serialize, serde_derive::Deserialize)
47)]
48#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
49pub struct SignedTransaction {
50 pub transaction: Transaction,
51 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=1).lift()))]
52 pub signatures: Vec<UserSignature>,
53}
54
55/// A TTL for a transaction
56///
57/// # BCS
58///
59/// The BCS serialized form for this type is defined by the following ABNF:
60///
61/// ```text
62/// transaction-expiration = %x00 ; none
63/// =/ %x01 u64 ; epoch
64/// ```
65#[derive(Clone, Copy, Default, Debug, PartialEq, Eq, Hash)]
66#[cfg_attr(
67 feature = "serde",
68 derive(serde_derive::Serialize, serde_derive::Deserialize)
69)]
70#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
71#[non_exhaustive]
72pub enum TransactionExpiration {
73 /// The transaction has no expiration
74 #[default]
75 None,
76
77 /// Validators wont sign a transaction unless the expiration Epoch
78 /// is greater than or equal to the current epoch
79 Epoch(EpochId),
80
81 /// ValidDuring enables gas payments from address balances.
82 ///
83 /// When transactions use address balances for gas payment instead of explicit gas coins,
84 /// we lose the natural transaction uniqueness and replay prevention that comes from
85 /// mutation of gas coin objects.
86 ///
87 /// By bounding expiration and providing a nonce, validators must only retain
88 /// executed digests for the maximum possible expiry range to differentiate
89 /// retries from unique transactions with otherwise identical inputs.
90 ValidDuring {
91 /// Transaction invalid before this epoch. Must equal current epoch.
92 min_epoch: Option<EpochId>,
93 /// Transaction expires after this epoch. Must equal current epoch
94 max_epoch: Option<EpochId>,
95 /// Future support for sub-epoch timing (not yet implemented)
96 min_timestamp: Option<u64>,
97 /// Future support for sub-epoch timing (not yet implemented)
98 max_timestamp: Option<u64>,
99 /// Network identifier to prevent cross-chain replay
100 chain: Digest,
101 /// User-provided uniqueness identifier to differentiate otherwise identical transactions
102 nonce: u32,
103 },
104}
105
106/// Payment information for executing a transaction
107///
108/// # BCS
109///
110/// The BCS serialized form for this type is defined by the following ABNF:
111///
112/// ```text
113/// gas-payment = (vector object-ref) ; gas coin objects
114/// address ; owner
115/// u64 ; price
116/// u64 ; budget
117/// ```
118#[derive(Clone, Debug, PartialEq, Eq)]
119#[cfg_attr(
120 feature = "serde",
121 derive(serde_derive::Serialize, serde_derive::Deserialize)
122)]
123#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
124pub struct GasPayment {
125 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
126 pub objects: Vec<ObjectReference>,
127
128 /// Owner of the gas objects, either the transaction sender or a sponsor
129 pub owner: Address,
130
131 /// Gas unit price to use when charging for computation
132 ///
133 /// Must be greater-than-or-equal-to the network's current RGP (reference gas price)
134 pub price: u64,
135
136 /// Total budget willing to spend for the execution of a transaction
137 pub budget: u64,
138}
139
140/// Randomness update
141///
142/// # BCS
143///
144/// The BCS serialized form for this type is defined by the following ABNF:
145///
146/// ```text
147/// randomness-state-update = u64 u64 bytes u64
148/// ```
149#[derive(Clone, Debug, PartialEq, Eq)]
150#[cfg_attr(
151 feature = "serde",
152 derive(serde_derive::Serialize, serde_derive::Deserialize)
153)]
154#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
155pub struct RandomnessStateUpdate {
156 /// Epoch of the randomness state update transaction
157 pub epoch: u64,
158
159 /// Randomness round of the update
160 pub randomness_round: u64,
161
162 /// Updated random bytes
163 #[cfg_attr(
164 feature = "serde",
165 serde(with = "crate::_serde::ReadableBase64Encoded")
166 )]
167 pub random_bytes: Vec<u8>,
168
169 /// The initial version of the randomness object that it was shared at.
170 pub randomness_obj_initial_shared_version: u64,
171}
172
173/// Transaction type
174///
175/// # BCS
176///
177/// The BCS serialized form for this type is defined by the following ABNF:
178///
179/// ```text
180/// transaction-kind = %x00 ptb
181/// =/ %x01 change-epoch
182/// =/ %x02 genesis-transaction
183/// =/ %x03 consensus-commit-prologue
184/// =/ %x04 authenticator-state-update
185/// =/ %x05 (vector end-of-epoch-transaction-kind)
186/// =/ %x06 randomness-state-update
187/// =/ %x07 consensus-commit-prologue-v2
188/// =/ %x08 consensus-commit-prologue-v3
189/// =/ %x09 consensus-commit-prologue-v4
190/// =/ %x0A ptb
191/// ```
192#[derive(Clone, Debug, PartialEq, Eq)]
193#[cfg_attr(
194 feature = "serde",
195 derive(serde_derive::Serialize, serde_derive::Deserialize)
196)]
197#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
198#[non_exhaustive]
199pub enum TransactionKind {
200 /// A user transaction comprised of a list of native commands and move calls
201 ProgrammableTransaction(ProgrammableTransaction),
202
203 /// System transaction used to end an epoch.
204 ///
205 /// The ChangeEpoch variant is now deprecated (but the ChangeEpoch struct is still used by
206 /// EndOfEpochTransaction below).
207 ChangeEpoch(ChangeEpoch),
208
209 /// Transaction used to initialize the chain state.
210 ///
211 /// Only valid if in the genesis checkpoint (0) and if this is the very first transaction ever
212 /// executed on the chain.
213 Genesis(GenesisTransaction),
214
215 /// V1 consensus commit update
216 ConsensusCommitPrologue(ConsensusCommitPrologue),
217
218 /// Update set of valid JWKs used for zklogin
219 AuthenticatorStateUpdate(AuthenticatorStateUpdate),
220
221 /// Set of operations to run at the end of the epoch to close out the current epoch and start
222 /// the next one.
223 EndOfEpoch(
224 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=1).lift()))]
225 Vec<EndOfEpochTransactionKind>,
226 ),
227
228 /// Randomness update
229 RandomnessStateUpdate(RandomnessStateUpdate),
230
231 /// V2 consensus commit update
232 ConsensusCommitPrologueV2(ConsensusCommitPrologueV2),
233
234 /// V3 consensus commit update
235 ConsensusCommitPrologueV3(ConsensusCommitPrologueV3),
236
237 /// V4 consensus commit update
238 ConsensusCommitPrologueV4(ConsensusCommitPrologueV4),
239
240 /// A system transaction comprised of a list of native commands and move calls
241 ProgrammableSystemTransaction(ProgrammableTransaction),
242}
243
244/// Operation run at the end of an epoch
245///
246/// # BCS
247///
248/// The BCS serialized form for this type is defined by the following ABNF:
249///
250/// ```text
251/// end-of-epoch-transaction-kind = eoe-change-epoch
252/// =/ eoe-authenticator-state-create
253/// =/ eoe-authenticator-state-expire
254/// =/ eoe-randomness-state-create
255/// =/ eoe-deny-list-state-create
256/// =/ eoe-bridge-state-create
257/// =/ eoe-bridge-committee-init
258/// =/ eoe-store-execution-time-observations
259///
260/// eoe-change-epoch = %x00 change-epoch
261/// eoe-authenticator-state-create = %x01
262/// eoe-authenticator-state-expire = %x02 authenticator-state-expire
263/// eoe-randomness-state-create = %x03
264/// eoe-deny-list-state-create = %x04
265/// eoe-bridge-state-create = %x05 digest
266/// eoe-bridge-committee-init = %x06 u64
267/// eoe-store-execution-time-observations = %x07 stored-execution-time-observations
268/// ```
269#[derive(Clone, Debug, PartialEq, Eq)]
270#[cfg_attr(
271 feature = "serde",
272 derive(serde_derive::Serialize, serde_derive::Deserialize)
273)]
274#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
275#[non_exhaustive]
276pub enum EndOfEpochTransactionKind {
277 /// End the epoch and start the next one
278 ChangeEpoch(ChangeEpoch),
279
280 /// Create and initialize the authenticator object used for zklogin
281 AuthenticatorStateCreate,
282
283 /// Expire JWKs used for zklogin
284 AuthenticatorStateExpire(AuthenticatorStateExpire),
285
286 /// Create and initialize the randomness object
287 RandomnessStateCreate,
288
289 /// Create and initialize the deny list object
290 DenyListStateCreate,
291
292 /// Create and initialize the bridge object
293 BridgeStateCreate { chain_id: Digest },
294
295 /// Initialize the bridge committee
296 BridgeCommitteeInit { bridge_object_version: u64 },
297
298 /// Execution time observations from the committee to preserve cross epoch
299 StoreExecutionTimeObservations(ExecutionTimeObservations),
300
301 /// Create and initialize the accumulator root object
302 AccumulatorRootCreate,
303
304 /// Create and initialize the coin metadata registry object
305 CoinRegistryCreate,
306
307 /// Create and initialize the display metadata registry object
308 DisplayRegistryCreate,
309
310 /// Create and initialize the address alias state object
311 AddressAliasStateCreate,
312
313 /// Contains the end-of-epoch-computed storage cost for accumulator objects.
314 WriteAccumulatorStorageCost { storage_cost: u64 },
315}
316
317/// Set of Execution Time Observations from the committee.
318///
319/// # BCS
320///
321/// The BCS serialized form for this type is defined by the following ABNF:
322///
323/// ```text
324/// stored-execution-time-observations = %x00 v1-stored-execution-time-observations
325///
326/// v1-stored-execution-time-observations = (vec
327/// execution-time-observation-key
328/// (vec execution-time-observation)
329/// )
330/// ```
331#[derive(Debug, Hash, PartialEq, Eq, Clone)]
332#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
333#[cfg_attr(
334 feature = "serde",
335 derive(serde_derive::Serialize, serde_derive::Deserialize)
336)]
337#[non_exhaustive]
338pub enum ExecutionTimeObservations {
339 V1(
340 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=1).lift()))]
341 Vec<(
342 ExecutionTimeObservationKey,
343 Vec<ValidatorExecutionTimeObservation>,
344 )>,
345 ),
346}
347
348/// An execution time observation from a particular validator
349///
350/// # BCS
351///
352/// The BCS serialized form for this type is defined by the following ABNF:
353///
354/// ```text
355/// execution-time-observation = bls-public-key duration
356/// duration = u64 ; seconds
357/// u32 ; subsecond nanoseconds
358/// ```
359#[derive(Debug, Hash, PartialEq, Eq, Clone)]
360#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
361#[cfg_attr(
362 feature = "serde",
363 derive(serde_derive::Serialize, serde_derive::Deserialize)
364)]
365pub struct ValidatorExecutionTimeObservation {
366 pub validator: crate::Bls12381PublicKey,
367 #[cfg_attr(feature = "proptest", strategy(proptest::strategy::Strategy::prop_map(proptest::arbitrary::any::<u32>(), |x| std::time::Duration::from_millis(x.into()))))]
368 pub duration: std::time::Duration,
369}
370
371/// Key for an execution time observation
372///
373/// # BCS
374///
375/// The BCS serialized form for this type is defined by the following ABNF:
376///
377/// ```text
378/// execution-time-observation-key = %x00 move-entry-point
379/// =/ %x01 ; transfer-objects
380/// =/ %x02 ; split-coins
381/// =/ %x03 ; merge-coins
382/// =/ %x04 ; publish
383/// =/ %x05 ; make-move-vec
384/// =/ %x06 ; upgrade
385/// ValidatorExecutionTimeObservation
386/// move-entry-point = address string string (vec type-tag)
387/// ```
388#[derive(Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Clone)]
389#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
390#[cfg_attr(
391 feature = "serde",
392 derive(serde_derive::Serialize, serde_derive::Deserialize)
393)]
394#[non_exhaustive]
395pub enum ExecutionTimeObservationKey {
396 // Containts all the fields from `ProgrammableMoveCall` besides `arguments`.
397 MoveEntryPoint {
398 /// The package containing the module and function.
399 package: Address,
400 /// The specific module in the package containing the function.
401 module: String,
402 /// The function to be called.
403 function: String,
404 /// The type arguments to the function.
405 /// NOTE: This field is currently not populated.
406 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=1).lift()))]
407 type_arguments: Vec<TypeTag>,
408 },
409 TransferObjects,
410 SplitCoins,
411 MergeCoins,
412 Publish, // special case: should not be used; we only use hard-coded estimate for this
413 MakeMoveVec,
414 Upgrade,
415}
416
417/// Expire old JWKs
418///
419/// # BCS
420///
421/// The BCS serialized form for this type is defined by the following ABNF:
422///
423/// ```text
424/// authenticator-state-expire = u64 u64
425/// ```
426#[derive(Clone, Debug, PartialEq, Eq)]
427#[cfg_attr(
428 feature = "serde",
429 derive(serde_derive::Serialize, serde_derive::Deserialize)
430)]
431#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
432pub struct AuthenticatorStateExpire {
433 /// expire JWKs that have a lower epoch than this
434 pub min_epoch: u64,
435
436 /// The initial version of the authenticator object that it was shared at.
437 pub authenticator_object_initial_shared_version: u64,
438}
439
440/// Update the set of valid JWKs
441///
442/// # BCS
443///
444/// The BCS serialized form for this type is defined by the following ABNF:
445///
446/// ```text
447/// authenticator-state-update = u64 ; epoch
448/// u64 ; round
449/// (vector active-jwk)
450/// u64 ; initial version of the authenticator object
451/// ```
452#[derive(Clone, Debug, PartialEq, Eq)]
453#[cfg_attr(
454 feature = "serde",
455 derive(serde_derive::Serialize, serde_derive::Deserialize)
456)]
457#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
458pub struct AuthenticatorStateUpdate {
459 /// Epoch of the authenticator state update transaction
460 pub epoch: u64,
461
462 /// Consensus round of the authenticator state update
463 pub round: u64,
464
465 /// newly active jwks
466 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=1).lift()))]
467 pub new_active_jwks: Vec<ActiveJwk>,
468
469 /// The initial version of the authenticator object that it was shared at.
470 pub authenticator_obj_initial_shared_version: u64,
471}
472
473/// A new Jwk
474///
475/// # BCS
476///
477/// The BCS serialized form for this type is defined by the following ABNF:
478///
479/// ```text
480/// active-jwk = jwk-id jwk u64
481/// ```
482#[derive(Clone, Debug, PartialEq, Eq)]
483#[cfg_attr(
484 feature = "serde",
485 derive(serde_derive::Serialize, serde_derive::Deserialize)
486)]
487#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
488pub struct ActiveJwk {
489 /// Identifier used to uniquely identify a Jwk
490 pub jwk_id: JwkId,
491
492 /// The Jwk
493 pub jwk: Jwk,
494
495 /// Most recent epoch in which the jwk was validated
496 pub epoch: u64,
497}
498
499/// V1 of the consensus commit prologue system transaction
500///
501/// # BCS
502///
503/// The BCS serialized form for this type is defined by the following ABNF:
504///
505/// ```text
506/// consensus-commit-prologue = u64 u64 u64
507/// ```
508#[derive(Clone, Debug, PartialEq, Eq)]
509#[cfg_attr(
510 feature = "serde",
511 derive(serde_derive::Serialize, serde_derive::Deserialize)
512)]
513#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
514pub struct ConsensusCommitPrologue {
515 /// Epoch of the commit prologue transaction
516 pub epoch: u64,
517
518 /// Consensus round of the commit
519 pub round: u64,
520
521 /// Unix timestamp from consensus
522 pub commit_timestamp_ms: CheckpointTimestamp,
523}
524
525/// V2 of the consensus commit prologue system transaction
526///
527/// # BCS
528///
529/// The BCS serialized form for this type is defined by the following ABNF:
530///
531/// ```text
532/// consensus-commit-prologue-v2 = u64 u64 u64 digest
533/// ```
534#[derive(Clone, Debug, PartialEq, Eq)]
535#[cfg_attr(
536 feature = "serde",
537 derive(serde_derive::Serialize, serde_derive::Deserialize)
538)]
539#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
540pub struct ConsensusCommitPrologueV2 {
541 /// Epoch of the commit prologue transaction
542 pub epoch: u64,
543
544 /// Consensus round of the commit
545 pub round: u64,
546
547 /// Unix timestamp from consensus
548 pub commit_timestamp_ms: CheckpointTimestamp,
549
550 /// Digest of consensus output
551 pub consensus_commit_digest: Digest,
552}
553
554/// Version assignments performed by consensus
555///
556/// # BCS
557///
558/// The BCS serialized form for this type is defined by the following ABNF:
559///
560/// ```text
561/// consensus-determined-version-assignments = canceled-transactions
562///
563/// canceled-transactions = %x00 (vector canceled-transaction)
564/// = %x01 (vector canceled-transaction-v2)
565/// ```
566#[derive(Clone, Debug, PartialEq, Eq)]
567#[cfg_attr(
568 feature = "serde",
569 derive(serde_derive::Serialize, serde_derive::Deserialize)
570)]
571#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
572#[non_exhaustive]
573pub enum ConsensusDeterminedVersionAssignments {
574 /// Canceled transaction version assignment.
575 CanceledTransactions {
576 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=1).lift()))]
577 canceled_transactions: Vec<CanceledTransaction>,
578 },
579 /// Canceled transaction version assignment V2.
580 CanceledTransactionsV2 {
581 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=1).lift()))]
582 canceled_transactions: Vec<CanceledTransactionV2>,
583 },
584}
585
586/// A transaction that was canceled
587///
588/// # BCS
589///
590/// The BCS serialized form for this type is defined by the following ABNF:
591///
592/// ```text
593/// canceled-transaction = digest (vector version-assignment)
594/// ```
595#[derive(Clone, Debug, PartialEq, Eq)]
596#[cfg_attr(
597 feature = "serde",
598 derive(serde_derive::Serialize, serde_derive::Deserialize)
599)]
600#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
601pub struct CanceledTransaction {
602 pub digest: Digest,
603 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
604 pub version_assignments: Vec<VersionAssignment>,
605}
606
607/// Object version assignment from consensus
608///
609/// # BCS
610///
611/// The BCS serialized form for this type is defined by the following ABNF:
612///
613/// ```text
614/// version-assignment = address u64
615/// ```
616#[derive(Clone, Debug, PartialEq, Eq)]
617#[cfg_attr(
618 feature = "serde",
619 derive(serde_derive::Serialize, serde_derive::Deserialize)
620)]
621#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
622pub struct VersionAssignment {
623 pub object_id: Address,
624 pub version: Version,
625}
626
627/// A transaction that was canceled
628///
629/// # BCS
630///
631/// The BCS serialized form for this type is defined by the following ABNF:
632///
633/// ```text
634/// canceled-transaction-v2 = digest (vector version-assignment-v2)
635/// ```
636#[derive(Clone, Debug, PartialEq, Eq)]
637#[cfg_attr(
638 feature = "serde",
639 derive(serde_derive::Serialize, serde_derive::Deserialize)
640)]
641#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
642pub struct CanceledTransactionV2 {
643 pub digest: Digest,
644 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
645 pub version_assignments: Vec<VersionAssignmentV2>,
646}
647
648/// Object version assignment from consensus
649///
650/// # BCS
651///
652/// The BCS serialized form for this type is defined by the following ABNF:
653///
654/// ```text
655/// version-assignment-v2 = address u64 u64
656/// ```
657#[derive(Clone, Debug, PartialEq, Eq)]
658#[cfg_attr(
659 feature = "serde",
660 derive(serde_derive::Serialize, serde_derive::Deserialize)
661)]
662#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
663pub struct VersionAssignmentV2 {
664 pub object_id: Address,
665 pub start_version: Version,
666 pub version: Version,
667}
668
669/// V3 of the consensus commit prologue system transaction
670///
671/// # BCS
672///
673/// The BCS serialized form for this type is defined by the following ABNF:
674///
675/// ```text
676/// consensus-commit-prologue-v3 = u64 u64 (option u64) u64 digest
677/// consensus-determined-version-assignments
678/// ```
679#[derive(Clone, Debug, PartialEq, Eq)]
680#[cfg_attr(
681 feature = "serde",
682 derive(serde_derive::Serialize, serde_derive::Deserialize)
683)]
684#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
685pub struct ConsensusCommitPrologueV3 {
686 /// Epoch of the commit prologue transaction
687 pub epoch: u64,
688
689 /// Consensus round of the commit
690 pub round: u64,
691
692 /// The sub DAG index of the consensus commit. This field will be populated if there
693 /// are multiple consensus commits per round.
694 pub sub_dag_index: Option<u64>,
695
696 /// Unix timestamp from consensus
697 pub commit_timestamp_ms: CheckpointTimestamp,
698
699 /// Digest of consensus output
700 pub consensus_commit_digest: Digest,
701
702 /// Stores consensus handler determined shared object version assignments.
703 pub consensus_determined_version_assignments: ConsensusDeterminedVersionAssignments,
704}
705
706/// V4 of the consensus commit prologue system transaction
707///
708/// # BCS
709///
710/// The BCS serialized form for this type is defined by the following ABNF:
711///
712/// ```text
713/// consensus-commit-prologue-v4 = u64 u64 (option u64) u64 digest
714/// consensus-determined-version-assignments
715/// digest
716/// ```
717#[derive(Clone, Debug, PartialEq, Eq)]
718#[cfg_attr(
719 feature = "serde",
720 derive(serde_derive::Serialize, serde_derive::Deserialize)
721)]
722#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
723pub struct ConsensusCommitPrologueV4 {
724 /// Epoch of the commit prologue transaction
725 pub epoch: u64,
726
727 /// Consensus round of the commit
728 pub round: u64,
729
730 /// The sub DAG index of the consensus commit. This field will be populated if there
731 /// are multiple consensus commits per round.
732 pub sub_dag_index: Option<u64>,
733
734 /// Unix timestamp from consensus
735 pub commit_timestamp_ms: CheckpointTimestamp,
736
737 /// Digest of consensus output
738 pub consensus_commit_digest: Digest,
739
740 /// Stores consensus handler determined shared object version assignments.
741 pub consensus_determined_version_assignments: ConsensusDeterminedVersionAssignments,
742
743 /// Digest of any additional state computed by the consensus handler.
744 /// Used to detect forking bugs as early as possible.
745 pub additional_state_digest: Digest,
746}
747
748/// System transaction used to change the epoch
749///
750/// # BCS
751///
752/// The BCS serialized form for this type is defined by the following ABNF:
753///
754/// ```text
755/// change-epoch = u64 ; next epoch
756/// u64 ; protocol version
757/// u64 ; storage charge
758/// u64 ; computation charge
759/// u64 ; storage rebate
760/// u64 ; non-refundable storage fee
761/// u64 ; epoch start timestamp
762/// (vector system-package)
763/// ```
764#[derive(Clone, Debug, PartialEq, Eq)]
765#[cfg_attr(
766 feature = "serde",
767 derive(serde_derive::Serialize, serde_derive::Deserialize)
768)]
769#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
770pub struct ChangeEpoch {
771 /// The next (to become) epoch ID.
772 pub epoch: EpochId,
773
774 /// The protocol version in effect in the new epoch.
775 pub protocol_version: ProtocolVersion,
776
777 /// The total amount of gas charged for storage during the epoch.
778 pub storage_charge: u64,
779
780 /// The total amount of gas charged for computation during the epoch.
781 pub computation_charge: u64,
782
783 /// The amount of storage rebate refunded to the txn senders.
784 pub storage_rebate: u64,
785
786 /// The non-refundable storage fee.
787 pub non_refundable_storage_fee: u64,
788
789 /// Unix timestamp when epoch started
790 pub epoch_start_timestamp_ms: u64,
791
792 /// System packages (specifically framework and move stdlib) that are written before the new
793 /// epoch starts. This tracks framework upgrades on chain. When executing the ChangeEpoch txn,
794 /// the validator must write out the modules below. Modules are provided with the version they
795 /// will be upgraded to, their modules in serialized form (which include their package ID), and
796 /// a list of their transitive dependencies.
797 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=1).lift()))]
798 pub system_packages: Vec<SystemPackage>,
799}
800
801/// System package
802///
803/// # BCS
804///
805/// The BCS serialized form for this type is defined by the following ABNF:
806///
807/// ```text
808/// system-package = u64 ; version
809/// (vector bytes) ; modules
810/// (vector address) ; dependencies
811/// ```
812#[derive(Clone, Debug, PartialEq, Eq)]
813#[cfg_attr(
814 feature = "serde",
815 derive(serde_derive::Serialize, serde_derive::Deserialize)
816)]
817#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
818pub struct SystemPackage {
819 pub version: Version,
820 #[cfg_attr(
821 feature = "serde",
822 serde(
823 with = "::serde_with::As::<Vec<::serde_with::IfIsHumanReadable<crate::_serde::Base64Encoded, ::serde_with::Bytes>>>"
824 )
825 )]
826 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=1).lift()))]
827 pub modules: Vec<Vec<u8>>,
828 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=1).lift()))]
829 pub dependencies: Vec<Address>,
830}
831
832/// The genesis transaction
833///
834/// # BCS
835///
836/// The BCS serialized form for this type is defined by the following ABNF:
837///
838/// ```text
839/// genesis-transaction = (vector genesis-object)
840/// ```
841#[derive(Clone, Debug, PartialEq, Eq)]
842#[cfg_attr(
843 feature = "serde",
844 derive(serde_derive::Serialize, serde_derive::Deserialize)
845)]
846#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
847pub struct GenesisTransaction {
848 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=1).lift()))]
849 pub objects: Vec<GenesisObject>,
850}
851
852/// A user transaction
853///
854/// Contains a series of native commands and move calls where the results of one command can be
855/// used in future commands.
856///
857/// # BCS
858///
859/// The BCS serialized form for this type is defined by the following ABNF:
860///
861/// ```text
862/// ptb = (vector input) (vector command)
863/// ```
864#[derive(Clone, Debug, PartialEq, Eq)]
865#[cfg_attr(
866 feature = "serde",
867 derive(serde_derive::Serialize, serde_derive::Deserialize)
868)]
869#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
870pub struct ProgrammableTransaction {
871 /// Input objects or primitive values
872 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=10).lift()))]
873 pub inputs: Vec<Input>,
874
875 /// The commands to be executed sequentially. A failure in any command will
876 /// result in the failure of the entire transaction.
877 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
878 pub commands: Vec<Command>,
879}
880
881/// An input to a user transaction
882///
883/// # BCS
884///
885/// The BCS serialized form for this type is defined by the following ABNF:
886///
887/// ```text
888/// input = input-pure / input-immutable-or-owned / input-shared / input-receiving
889///
890/// input-pure = %x00 bytes
891/// input-immutable-or-owned = %x01 object-ref
892/// input-shared = %x02 address u64 bool
893/// input-receiving = %x04 object-ref
894/// ```
895#[derive(Clone, Debug, PartialEq, Eq)]
896#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
897#[non_exhaustive]
898pub enum Input {
899 /// A move value serialized as BCS.
900 ///
901 /// For normal operations this is required to be a move primitive type and not contain structs
902 /// or objects.
903 Pure(Vec<u8>),
904
905 /// A move object that is either immutable or address owned
906 ImmutableOrOwned(ObjectReference),
907
908 /// A move object whose owner is "Shared"
909 Shared(SharedInput),
910
911 /// A move object that is attempted to be received in this transaction.
912 Receiving(ObjectReference),
913
914 /// Reservation to withdraw balance from a funds accumulator. This will be converted into a
915 /// `sui::funds_accumulator::Withdrawal` struct and passed into Move.
916 /// It is allowed to have multiple withdraw arguments even for the same funds type.
917 FundsWithdrawal(FundsWithdrawal),
918}
919
920/// A move object whose owner is "Shared"
921#[derive(Clone, Debug, PartialEq, Eq)]
922#[cfg_attr(
923 feature = "serde",
924 derive(serde_derive::Serialize, serde_derive::Deserialize)
925)]
926#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
927pub struct SharedInput {
928 object_id: Address,
929 version: u64,
930 mutability: Mutability,
931}
932
933impl SharedInput {
934 pub fn new<M: Into<Mutability>>(object_id: Address, version: u64, mutable: M) -> Self {
935 Self {
936 object_id,
937 version,
938 mutability: mutable.into(),
939 }
940 }
941
942 pub fn object_id(&self) -> Address {
943 self.object_id
944 }
945
946 pub fn version(&self) -> u64 {
947 self.version
948 }
949
950 pub fn mutability(&self) -> Mutability {
951 self.mutability
952 }
953}
954
955#[derive(Copy, Clone, Debug, PartialEq, Eq)]
956#[cfg_attr(
957 feature = "serde",
958 derive(serde_derive::Serialize, serde_derive::Deserialize)
959)]
960#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
961pub enum Mutability {
962 // The "classic" mutable/immutable modes.
963 Immutable,
964 Mutable,
965 // Non-exclusive write is used to allow multiple transactions to
966 // simultaneously add disjoint dynamic fields to an object.
967 // (Currently only used by settlement transactions).
968 NonExclusiveWrite,
969}
970
971impl From<bool> for Mutability {
972 fn from(mutable: bool) -> Self {
973 if mutable {
974 Self::Mutable
975 } else {
976 Self::Immutable
977 }
978 }
979}
980
981impl Mutability {
982 pub fn is_mutable(self) -> bool {
983 match self {
984 Mutability::Immutable => false,
985 Mutability::Mutable => true,
986 Mutability::NonExclusiveWrite => false,
987 }
988 }
989}
990
991#[derive(Debug, PartialEq, Eq, Hash, Clone)]
992#[cfg_attr(
993 feature = "serde",
994 derive(serde_derive::Serialize, serde_derive::Deserialize)
995)]
996#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
997#[non_exhaustive]
998enum Reservation {
999 // Reserve a specific amount of the balance.
1000 Amount(u64),
1001}
1002
1003#[derive(Debug, PartialEq, Eq, Hash, Clone)]
1004#[cfg_attr(
1005 feature = "serde",
1006 derive(serde_derive::Serialize, serde_derive::Deserialize)
1007)]
1008#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
1009#[non_exhaustive]
1010enum WithdrawalType {
1011 Balance(TypeTag),
1012}
1013
1014#[derive(Debug, PartialEq, Eq, Hash, Clone)]
1015#[cfg_attr(
1016 feature = "serde",
1017 derive(serde_derive::Serialize, serde_derive::Deserialize)
1018)]
1019#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
1020pub struct FundsWithdrawal {
1021 /// The reservation of the funds accumulator to withdraw.
1022 reservation: Reservation,
1023 /// The type argument of the funds accumulator to withdraw, e.g. `Balance<_>`.
1024 type_: WithdrawalType,
1025 /// The source of the funds to withdraw.
1026 source: WithdrawFrom,
1027}
1028
1029impl FundsWithdrawal {
1030 pub fn new(amount: u64, coin_type: TypeTag, source: WithdrawFrom) -> Self {
1031 Self {
1032 reservation: Reservation::Amount(amount),
1033 type_: WithdrawalType::Balance(coin_type),
1034 source,
1035 }
1036 }
1037
1038 pub fn amount(&self) -> Option<u64> {
1039 match self.reservation {
1040 Reservation::Amount(amount) => Some(amount),
1041 }
1042 }
1043
1044 pub fn coin_type(&self) -> &TypeTag {
1045 match &self.type_ {
1046 WithdrawalType::Balance(coin_type) => coin_type,
1047 }
1048 }
1049
1050 pub fn source(&self) -> WithdrawFrom {
1051 self.source
1052 }
1053}
1054
1055#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
1056#[cfg_attr(
1057 feature = "serde",
1058 derive(serde_derive::Serialize, serde_derive::Deserialize)
1059)]
1060#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
1061#[non_exhaustive]
1062pub enum WithdrawFrom {
1063 /// Withdraw from the sender of the transaction.
1064 Sender,
1065 /// Withdraw from the sponsor of the transaction (gas owner).
1066 Sponsor,
1067}
1068
1069/// A single command in a programmable transaction.
1070///
1071/// # BCS
1072///
1073/// The BCS serialized form for this type is defined by the following ABNF:
1074///
1075/// ```text
1076/// command = command-move-call
1077/// =/ command-transfer-objects
1078/// =/ command-split-coins
1079/// =/ command-merge-coins
1080/// =/ command-publish
1081/// =/ command-make-move-vector
1082/// =/ command-upgrade
1083///
1084/// command-move-call = %x00 move-call
1085/// command-transfer-objects = %x01 transfer-objects
1086/// command-split-coins = %x02 split-coins
1087/// command-merge-coins = %x03 merge-coins
1088/// command-publish = %x04 publish
1089/// command-make-move-vector = %x05 make-move-vector
1090/// command-upgrade = %x06 upgrade
1091/// ```
1092#[derive(Clone, Debug, PartialEq, Eq)]
1093#[cfg_attr(
1094 feature = "serde",
1095 derive(serde_derive::Serialize, serde_derive::Deserialize)
1096)]
1097#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
1098#[non_exhaustive]
1099pub enum Command {
1100 /// A call to either an entry or a public Move function
1101 MoveCall(MoveCall),
1102
1103 /// `(Vec<forall T:key+store. T>, address)`
1104 /// It sends n-objects to the specified address. These objects must have store
1105 /// (public transfer) and either the previous owner must be an address or the object must
1106 /// be newly created.
1107 TransferObjects(TransferObjects),
1108
1109 /// `(&mut Coin<T>, Vec<u64>)` -> `Vec<Coin<T>>`
1110 /// It splits off some amounts into a new coins with those amounts
1111 SplitCoins(SplitCoins),
1112
1113 /// `(&mut Coin<T>, Vec<Coin<T>>)`
1114 /// It merges n-coins into the first coin
1115 MergeCoins(MergeCoins),
1116
1117 /// Publishes a Move package. It takes the package bytes and a list of the package's transitive
1118 /// dependencies to link against on-chain.
1119 Publish(Publish),
1120
1121 /// `forall T: Vec<T> -> vector<T>`
1122 /// Given n-values of the same type, it constructs a vector. For non objects or an empty vector,
1123 /// the type tag must be specified.
1124 MakeMoveVector(MakeMoveVector),
1125
1126 /// Upgrades a Move package
1127 /// Takes (in order):
1128 /// 1. A vector of serialized modules for the package.
1129 /// 2. A vector of object ids for the transitive dependencies of the new package.
1130 /// 3. The object ID of the package being upgraded.
1131 /// 4. An argument holding the `UpgradeTicket` that must have been produced from an earlier command in the same
1132 /// programmable transaction.
1133 Upgrade(Upgrade),
1134}
1135
1136/// Command to transfer ownership of a set of objects to an address
1137///
1138/// # BCS
1139///
1140/// The BCS serialized form for this type is defined by the following ABNF:
1141///
1142/// ```text
1143/// transfer-objects = (vector argument) argument
1144/// ```
1145#[derive(Clone, Debug, PartialEq, Eq)]
1146#[cfg_attr(
1147 feature = "serde",
1148 derive(serde_derive::Serialize, serde_derive::Deserialize)
1149)]
1150#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
1151pub struct TransferObjects {
1152 /// Set of objects to transfer
1153 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
1154 pub objects: Vec<Argument>,
1155
1156 /// The address to transfer ownership to
1157 pub address: Argument,
1158}
1159
1160/// Command to split a single coin object into multiple coins
1161///
1162/// # BCS
1163///
1164/// The BCS serialized form for this type is defined by the following ABNF:
1165///
1166/// ```text
1167/// split-coins = argument (vector argument)
1168/// ```
1169#[derive(Clone, Debug, PartialEq, Eq)]
1170#[cfg_attr(
1171 feature = "serde",
1172 derive(serde_derive::Serialize, serde_derive::Deserialize)
1173)]
1174#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
1175pub struct SplitCoins {
1176 /// The coin to split
1177 pub coin: Argument,
1178
1179 /// The amounts to split off
1180 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
1181 pub amounts: Vec<Argument>,
1182}
1183
1184/// Command to merge multiple coins of the same type into a single coin
1185///
1186/// # BCS
1187///
1188/// The BCS serialized form for this type is defined by the following ABNF:
1189///
1190/// ```text
1191/// merge-coins = argument (vector argument)
1192/// ```
1193#[derive(Clone, Debug, PartialEq, Eq)]
1194#[cfg_attr(
1195 feature = "serde",
1196 derive(serde_derive::Serialize, serde_derive::Deserialize)
1197)]
1198#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
1199pub struct MergeCoins {
1200 /// Coin to merge coins into
1201 pub coin: Argument,
1202
1203 /// Set of coins to merge into `coin`
1204 ///
1205 /// All listed coins must be of the same type and be the same type as `coin`
1206 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
1207 pub coins_to_merge: Vec<Argument>,
1208}
1209
1210/// Command to publish a new move package
1211///
1212/// # BCS
1213///
1214/// The BCS serialized form for this type is defined by the following ABNF:
1215///
1216/// ```text
1217/// publish = (vector bytes) ; the serialized move modules
1218/// (vector address) ; the set of package dependencies
1219/// ```
1220#[derive(Clone, Debug, PartialEq, Eq)]
1221#[cfg_attr(
1222 feature = "serde",
1223 derive(serde_derive::Serialize, serde_derive::Deserialize)
1224)]
1225#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
1226pub struct Publish {
1227 /// The serialized move modules
1228 #[cfg_attr(
1229 feature = "serde",
1230 serde(
1231 with = "::serde_with::As::<Vec<::serde_with::IfIsHumanReadable<crate::_serde::Base64Encoded, ::serde_with::Bytes>>>"
1232 )
1233 )]
1234 pub modules: Vec<Vec<u8>>,
1235
1236 /// Set of packages that the to-be published package depends on
1237 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
1238 pub dependencies: Vec<Address>,
1239}
1240
1241/// Command to build a move vector out of a set of individual elements
1242///
1243/// # BCS
1244///
1245/// The BCS serialized form for this type is defined by the following ABNF:
1246///
1247/// ```text
1248/// make-move-vector = (option type-tag) (vector argument)
1249/// ```
1250#[derive(Clone, Debug, PartialEq, Eq)]
1251#[cfg_attr(
1252 feature = "serde",
1253 derive(serde_derive::Serialize, serde_derive::Deserialize)
1254)]
1255#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
1256pub struct MakeMoveVector {
1257 /// Type of the individual elements
1258 ///
1259 /// This is required to be set when the type can't be inferred, for example when the set of
1260 /// provided arguments are all pure input values.
1261 #[cfg_attr(feature = "serde", serde(rename = "type"))]
1262 pub type_: Option<TypeTag>,
1263
1264 /// The set individual elements to build the vector with
1265 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
1266 pub elements: Vec<Argument>,
1267}
1268
1269/// Command to upgrade an already published package
1270///
1271/// # BCS
1272///
1273/// The BCS serialized form for this type is defined by the following ABNF:
1274///
1275/// ```text
1276/// upgrade = (vector bytes) ; move modules
1277/// (vector address) ; dependencies
1278/// address ; package-id of the package
1279/// argument ; upgrade ticket
1280/// ```
1281#[derive(Clone, Debug, PartialEq, Eq)]
1282#[cfg_attr(
1283 feature = "serde",
1284 derive(serde_derive::Serialize, serde_derive::Deserialize)
1285)]
1286#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
1287pub struct Upgrade {
1288 /// The serialized move modules
1289 #[cfg_attr(
1290 feature = "serde",
1291 serde(
1292 with = "::serde_with::As::<Vec<::serde_with::IfIsHumanReadable<crate::_serde::Base64Encoded, ::serde_with::Bytes>>>"
1293 )
1294 )]
1295 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=1).lift()))]
1296 pub modules: Vec<Vec<u8>>,
1297
1298 /// Set of packages that the to-be published package depends on
1299 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
1300 pub dependencies: Vec<Address>,
1301
1302 /// Package id of the package to upgrade
1303 pub package: Address,
1304
1305 /// Ticket authorizing the upgrade
1306 pub ticket: Argument,
1307}
1308
1309/// An argument to a programmable transaction command
1310///
1311/// # BCS
1312///
1313/// The BCS serialized form for this type is defined by the following ABNF:
1314///
1315/// ```text
1316/// argument = argument-gas
1317/// =/ argument-input
1318/// =/ argument-result
1319/// =/ argument-nested-result
1320///
1321/// argument-gas = %x00
1322/// argument-input = %x01 u16
1323/// argument-result = %x02 u16
1324/// argument-nested-result = %x03 u16 u16
1325/// ```
1326#[derive(Clone, Copy, Debug, PartialEq, Eq)]
1327#[cfg_attr(
1328 feature = "serde",
1329 derive(serde_derive::Serialize, serde_derive::Deserialize)
1330)]
1331#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
1332pub enum Argument {
1333 /// The gas coin. The gas coin can only be used by-ref, except for with
1334 /// `TransferObjects`, which can use it by-value.
1335 Gas,
1336
1337 /// One of the input objects or primitive values (from
1338 /// `ProgrammableTransaction` inputs)
1339 Input(u16),
1340
1341 /// The result of another command (from `ProgrammableTransaction` commands)
1342 Result(u16),
1343
1344 /// Like a `Result` but it accesses a nested result. Currently, the only usage
1345 /// of this is to access a value from a Move call with multiple return values.
1346 // (command index, subresult index)
1347 NestedResult(u16, u16),
1348}
1349
1350impl Argument {
1351 /// Turn a Result into a NestedResult. If the argument is not a Result, returns None.
1352 pub fn nested(&self, ix: u16) -> Option<Argument> {
1353 match self {
1354 Argument::Result(i) => Some(Argument::NestedResult(*i, ix)),
1355 _ => None,
1356 }
1357 }
1358}
1359
1360/// Command to call a move function
1361///
1362/// Functions that can be called by a `MoveCall` command are those that have a function signature
1363/// that is either `entry` or `public` (which don't have a reference return type).
1364///
1365/// # BCS
1366///
1367/// The BCS serialized form for this type is defined by the following ABNF:
1368///
1369/// ```text
1370/// move-call = address ; package id
1371/// identifier ; module name
1372/// identifier ; function name
1373/// (vector type-tag) ; type arguments, if any
1374/// (vector argument) ; input arguments
1375/// ```
1376#[derive(Clone, Debug, PartialEq, Eq)]
1377#[cfg_attr(
1378 feature = "serde",
1379 derive(serde_derive::Serialize, serde_derive::Deserialize)
1380)]
1381#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))]
1382pub struct MoveCall {
1383 /// The package containing the module and function.
1384 pub package: Address,
1385
1386 /// The specific module in the package containing the function.
1387 pub module: Identifier,
1388
1389 /// The function to be called.
1390 pub function: Identifier,
1391
1392 /// The type arguments to the function.
1393 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
1394 pub type_arguments: Vec<TypeTag>,
1395
1396 /// The arguments to the function.
1397 #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
1398 pub arguments: Vec<Argument>,
1399}