@@ -493,23 +493,22 @@ An `AccountInfo` reference is passed to the function.
493493```
494494
495495``` {.k .concrete}
496- rule #addAccount(Aggregate(variantIdx(0), _:List ListItem(Integer(DATA_LEN, 64, false)) ) #as P_ACC)
496+ rule #addAccount(Aggregate(variantIdx(0), _) #as P_ACC)
497497 => PAccountAccount(
498- #toPAcc (P_ACC),
499- IAcc(#randKey(), // mint
500- #randKey(), // owner
501- #randAmount(), // amount
502- Flag(#randU1()), // delegateflag, only 0 or 1 allowed
503- #randKey(), // delegate
504- U8(#randU8()), // state
505- Flag(#randU1()), // nativeflag, only 0 or 1 allowed
506- #randAmount(), // native_amount
507- #randAmount(), // deleg_amount
508- Flag(#randU1()), // closeflag, only 0 or 1 allowed
509- #randKey() // close_auth
498+ #toPAccWithDataLen (P_ACC, 165), // size_of(Account), see pinocchio_token_interface::state::Transmutable instance
499+ IAcc(#randKey(), // mint
500+ #randKey(), // owner
501+ #randAmount(), // amount
502+ Flag(#randU1()), // delegateflag, only 0 or 1 allowed
503+ #randKey(), // delegate
504+ U8(#randU8()), // state
505+ Flag(#randU1()), // nativeflag, only 0 or 1 allowed
506+ #randAmount(), // native_amount
507+ #randAmount(), // deleg_amount
508+ Flag(#randU1()), // closeflag, only 0 or 1 allowed
509+ #randKey() // close_auth
510510 )
511511 )
512- requires DATA_LEN ==Int 165 // size_of(Account), see pinocchio_token_interface::state::Transmutable instance
513512```
514513
515514#### ` #addMint `
@@ -538,19 +537,18 @@ An `AccountInfo` reference is passed to the function.
538537```
539538
540539``` {.k .concrete}
541- rule #addMint(Aggregate(variantIdx(0), _:List ListItem(Integer(DATA_LEN, 64, false)) ) #as P_ACC)
540+ rule #addMint(Aggregate(variantIdx(0), _) #as P_ACC)
542541 => PAccountMint(
543- #toPAcc (P_ACC),
544- IMint(Flag(#randU1()), // mint_auth_flag, only 0 or 1 allowed
545- #randKey(), // mint_auth_key
546- #randAmount(), // supply
547- U8(#randU8()), // decimals
548- U8(#randU1()), // initialized, only 0 or 1 allowed
549- Flag(#randU1()), // freeze_auth_flag, only 0 or 1 allowed
550- #randKey() // freeze_auth_key
542+ #toPAccWithDataLen (P_ACC, 82), // size_of(Mint), see pinocchio_token_interface::state::Transmutable instance
543+ IMint(Flag(#randU1()), // mint_auth_flag, only 0 or 1 allowed
544+ #randKey(), // mint_auth_key
545+ #randAmount(), // supply
546+ U8(#randU8()), // decimals
547+ U8(#randU1()), // initialized, only 0 or 1 allowed
548+ Flag(#randU1()), // freeze_auth_flag, only 0 or 1 allowed
549+ #randKey() // freeze_auth_key
551550 )
552551 )
553- requires DATA_LEN ==Int 82 // size_of(Mint), see pinocchio_token_interface::state::Transmutable instance
554552```
555553
556554#### ` #addRent `
@@ -571,16 +569,15 @@ An `AccountInfo` reference is passed to the function.
571569```
572570
573571``` {.k .concrete}
574- rule #addRent(Aggregate(variantIdx(0), _:List ListItem(Integer(DATA_LEN, 64, false)) ) #as P_ACC)
572+ rule #addRent(Aggregate(variantIdx(0), _) #as P_ACC)
575573 => PAccountRent(
576- #toPAcc (P_ACC),
574+ #toPAccWithDataLen (P_ACC, 17), // size_of(Rent), see pinocchio::sysvars::rent::Rent::LEN
577575 PRent(
578576 U64(#randU64()), // lmp_per_byteyear
579577 F64(#randExemptThreshold()), // exempt_threshold
580578 U8(#randU8()) // burn_pct
581579 )
582580 )
583- requires DATA_LEN ==Int 17 // size_of(Rent), see pinocchio::sysvars::rent::Rent::LEN
584581```
585582
586583### Establishing Access to the Second Component of a ` PAccount ` -sorted Value
@@ -884,6 +881,26 @@ NB The projection rule must have higher priority than the one which auto-project
884881## Helpers for fuzzing
885882
886883``` {.k .concrete}
884+ syntax PAcc ::= #toPAccWithDataLen ( value: Value, dataLen: Int ) [function, total]
885+ rule #toPAccWithDataLen(
886+ Aggregate(
887+ variantIdx(0),
888+ ListItem(Integer(A, 8, false)) // borrow_state (custom solution to manage read/write borrows)
889+ ListItem(Integer(B, 8, false)) // is_signer (comment: whether transaction was signed by this account)
890+ ListItem(Integer(C, 8, false)) // is_writable
891+ ListItem(Integer(D, 8, false)) // executable (comment: whether this account represents a program)
892+ ListItem(Integer(E, 32, true)) // resize_delta (comment: "guaranteed to be zero at start")
893+ ListItem(KEY1BYTES) // account key
894+ ListItem(KEY2BYTES) // owner key
895+ ListItem(Integer(X, 64, false)) // lamports
896+ ListItem(Integer(_, 64, false)) // data_len (dependent on 2nd component, will be overwritten with DATA_LEN)
897+ ),
898+ DATA_LEN
899+ )
900+ =>
901+ PAcc (U8(A), U8(B), U8(C), U8(D), I32(E), toKey(KEY1BYTES), toKey(KEY2BYTES), U64(X), U64(DATA_LEN))
902+ rule #toPAccWithDataLen(OTHER, _) => PAccError(OTHER) [owise]
903+
887904 syntax Int ::= #randU1() [function, total, impure, symbol(randU1) ]
888905 | #randU8() [function, total, impure, symbol(randU8) ]
889906 | #randU32() [function, total, impure, symbol(randU32)]
0 commit comments