Open deepthiskumar opened 1 year ago
The above changes would greatly increase the size of generated parties. This would directly affect the transaction_pool.ml
test. Since the size of parties are increased, the size of keymap would also need to be increased. Thus any code that uses gen_parties_from
function needs to modifies the generation of keymap to keep up with the changes.
For token transfers and token minting, we want to make it as generalized as possible. Currently token transactions are generated using a helper function called
gen_parties_with_token_accounts
. This function generations a tree of parties. Right now it simply outputs a tree with root (token-owner's party) and a single node (party for minted token). I would use some pseudo-code to display this functionHere's a plan to make token transactions more randomized in a few steps:
account_state_tbl
type account_state_tbl = (Account.t * role) Account_id.Table.t
val token_holders : account_state_tbl -> ~token_owner:Account_id.t -> Account_id.t
let gen_parties_with_token_accounts ~num_parties ~depth = let rec gen_tree n = if n <= 0 then return [] else let%bind parent = gen_party_from ... in let%bind has_child = Quickcheck.Generators.bool in let%bind num_of_children = if has_child then Int.gen_uniform_incl 1 width else return 0 in let%bind children = Quickcheck.Generators.list_with_length num_of_children ( let%bind account_id = let holders = token_holders account_state_tbl ~token_owner:parent.account_id in if List.is_empty holders then return None else let%bind token_transfer = Quickcheck.Generators.bool in Quickcheck.Generators.of_list holders in gen_party_from ... ~account_id ...) in gen_tree (mk_node parent (List.map children ~f:(fun child -> mk_node child (gen_tree (n-1)))) in let rec go acc n = if n <= 0 then return (List.rev acc) else let%bind tree = gen_tree depth in go (tree :: acc) (n - 1) in go [] num_parties