-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Carry next_available_token in Sparse_ledger.t * Track the next_available_token in Blockchain_state.t * Rename next_available_token to snarked_next_available_token This makes it clear that the next_available_token is associated with the snarked ledger, not the staged ledger. Credit to @psteckler for pointing out the ambiguity. * Add more informative logging to debug CI failure * Use [%%versioned: ...] ppx for Sparse_ledger.t * Disable next_available_token in Statement.gen * Revert "Disable next_available_token in Statement.gen" This reverts commit 95d0ee3. * Log full transitions when there's an error * Revert "Log full transitions when there's an error" This reverts commit bf13182. * Fix error: swap token for new_next_available_token * Use fold rather than iter with a reference * Add Create_new_token and Create_token_account commands * Commit Coda_base.{New_account_payload,New_token_payload} * Fix nonconsensus build for token account creation * Enable account creation in the snark * Allow Create_token_account to create default-token accounts * Don't increment next_available_token in the snark if the command fails * Lift curr_global_slot calculation in the profiler into a lazy global * Remove unnecessary Lazy.force * Replace mutability with folds * Name a discarded variable * Explode _ pattern * Factor out charge_account_creation_fee_exn in transaction logic * Use the new token in user command failure for token creation commands * Give a discarded pattern a descriptive name * Combine undo branches for Create_new_token, Create_token_account * Check whether receiver account exists before creating it * Fix copy/paste typo: receiver -> source * Explicitly pass next_available_token_after for snarks, to handle failure * Fix account fallthrough check for source when creating token accounts * Charge fee-payer in snark for token account creation too * Disable/defer predicate check for Create_new_token/Create_token_account * Do not modify account's token_owner field except when creating * Add unit tests for token/account creation commands * Add Mint_tokens command * Add unit tests for token minting * Check-in minting payload * Fix copy/paste typo: is_create_account -> is_mint_tokens * Add Minting_payload in nonconsensus * Remove unused function is_valid_user_command
- Loading branch information
Showing
23 changed files
with
677 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
open Core_kernel | ||
open Import | ||
|
||
[%%versioned | ||
module Stable = struct | ||
module V1 = struct | ||
type t = | ||
{ token_id: Token_id.Stable.V1.t | ||
; token_owner_pk: Public_key.Compressed.Stable.V1.t | ||
; receiver_pk: Public_key.Compressed.Stable.V1.t | ||
; amount: Currency.Amount.Stable.V1.t } | ||
[@@deriving compare, eq, sexp, hash, yojson] | ||
|
||
let to_latest = Fn.id | ||
end | ||
end] | ||
|
||
type t = Stable.Latest.t = | ||
{ token_id: Token_id.t | ||
; token_owner_pk: Public_key.Compressed.t | ||
; receiver_pk: Public_key.Compressed.t | ||
; amount: Currency.Amount.t } | ||
[@@deriving compare, eq, sexp, hash, yojson] | ||
|
||
let receiver_pk {receiver_pk; _} = receiver_pk | ||
|
||
let receiver {token_id; receiver_pk; _} = | ||
Account_id.create receiver_pk token_id | ||
|
||
let source_pk {token_owner_pk; _} = token_owner_pk | ||
|
||
let source {token_id; token_owner_pk; _} = | ||
Account_id.create token_owner_pk token_id | ||
|
||
let token {token_id; _} = token_id | ||
|
||
let gen = | ||
let open Quickcheck.Generator.Let_syntax in | ||
let%bind token_id = Token_id.gen_non_default in | ||
let%bind token_owner_pk = Public_key.Compressed.gen in | ||
let%bind receiver_pk = Public_key.Compressed.gen in | ||
let%map amount = Currency.Amount.gen in | ||
{token_id; token_owner_pk; receiver_pk; amount} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.