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

delegation command #1124

Merged
merged 53 commits into from Nov 15, 2018

Conversation

Projects
None yet
2 participants
@imeckler
Contributor

imeckler commented Nov 11, 2018

This creates a stake delegation user command and reorgs the transaction snark to make it easier to integrate there. All the semantics are reflected in the transaction snark.

I also pulled in @deepthiskumar coinbase semantics fixes from the other PR, because I had reorganized the snark so much that I more or less had to rewrite it anyway

imeckler added some commits Nov 10, 2018

transaction union: payload
transaction union: payload remove commented out code

@imeckler imeckler changed the base branch from feature/delegate-in-account to master Nov 12, 2018

@imeckler imeckler requested a review from bkase Nov 12, 2018

in
let%bind () = validate_nonces nonce sender_account.nonce in
let sender_account_without_balance_modified =

This comment has been minimized.

@bkase

bkase Nov 13, 2018

Contributor

this is no longer a good name since balance was modified by fee at this point

set ledger receiver_location
{receiver_account with balance= receiver_balance'} ;
remove_accounts_exn ledger previous_empty_accounts
| _, _ -> assert false

This comment has been minimized.

@bkase

bkase Nov 13, 2018

Contributor

failwith "undo doesn't correspond with command"


let is_user_command (_, b1) = return (Boolean.not b1)

let%test_module "predicates" =

This comment has been minimized.

@bkase

bkase Nov 13, 2018

Contributor

this is awesome

(fun H_list.([sender_delta; receiver_increase; excess; supply_increase])
-> {sender_delta; receiver_increase; excess; supply_increase} )

let of_payload (payload : payload) : t =

This comment has been minimized.

@bkase

bkase Nov 13, 2018

Contributor

The code makes sense to me, but just so it's easier for people to understand how we interpret the payload in different cases, can you add a big doc-comment above this explaining how the different fields are interpreted when different tags are present (you can put this somewhere else if you think this is not the right place).

It's a bit subtle that fee moves are packed twice in Fee_transfer and that Coinbase handles a fee also

This comment has been minimized.

@bkase

bkase Nov 13, 2018

Contributor

This should probably be on of_transaction in transaction_union.ml

This comment has been minimized.

@bkase

bkase Nov 13, 2018

Contributor

Or maybe as doc-comments in the mli files for user_command, coinbase, fee_transfer etc.

| Coinbase ->
(* In this case,
fee - amount should be defined. In other words,
fee >= amount. *)

This comment has been minimized.

@bkase

bkase Nov 13, 2018

Contributor

we should assert this wherever we're making the coinbase payload

This comment has been minimized.

@imeckler

imeckler Nov 14, 2018

Contributor

We check this on the coinbase (see coinbase.is_valid)

| Stake_delegation (Set_delegate {new_delegate}) ->
{ tag= Tag.Stake_delegation
; public_key= new_delegate
; amount= Currency.Amount.zero }

This comment has been minimized.

@bkase

bkase Nov 13, 2018

Contributor

we could stuff a fee-transfer here too right? Amount is seems unused

This comment has been minimized.

@bkase

bkase Nov 13, 2018

Contributor

ah we don't have space to specify the public key which would receive amount

This comment has been minimized.

@imeckler

imeckler Nov 13, 2018

Contributor

yeah -- you could have a fee transfer to the public key of the person you're delegating to though :)

~value_to_hlist:to_hlist ~value_of_hlist:of_hlist

let dummy_signature =
Schnorr.sign (Private_key.create ()) User_command_payload.dummy

This comment has been minimized.

@bkase

bkase Nov 13, 2018

Contributor

I wonder if we should be making these dummy signatures lazy everywhere -- it could adversely affect startup time (we can measure that later though)

imeckler added some commits Nov 14, 2018

@bkase

bkase approved these changes Nov 14, 2018

imeckler and others added some commits Nov 14, 2018

delegation cli command (#1138)
This is a basic CLI for setting one's delegate

@imeckler imeckler merged commit bd4c513 into master Nov 15, 2018

8 checks passed

ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: build_public Your tests passed on CircleCI!
Details
ci/circleci: build_withsnark Your tests passed on CircleCI!
Details
ci/circleci: test-all_sig_integration_tests Your tests passed on CircleCI!
Details
ci/circleci: test-all_stake_integration_tests Your tests passed on CircleCI!
Details
ci/circleci: test-unit-test Your tests passed on CircleCI!
Details
ci/circleci: test-withsnark Your tests passed on CircleCI!
Details
ci/circleci: tracetool Your tests passed on CircleCI!
Details

@imeckler imeckler deleted the feature/delegation-command branch Nov 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment