-
Notifications
You must be signed in to change notification settings - Fork 524
Allow setting manager, reserve, freeze, and clawback at goal asset create #3369
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
Allow setting manager, reserve, freeze, and clawback at goal asset create #3369
Conversation
|
Thank you! This looks good by eye, we just need some simple tests. You could add them to You could do another To run just that test, you should be able to do |
|
Added a test for I removed the |
This is weird. I don't think this should happen, I can't find any code in goal or algod that would do this on purpose, so I'd like to figure out if there's a bug here. What exactly did you see? |
jannotti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we figure out this reserve address thing, it looks good!
test/scripts/e2e_subs/asset-misc.sh
Outdated
| # create asset with a manager that is different from the creator | ||
| ${gcmd} asset create --creator "${ACCOUNT}" --manager "${ACCOUNTB}" --name "${ASSET_NAME}" --unitname dma --total 1000000000000 --asseturl "${ASSET_URL}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer that this sets all of the different address types, not just manager, and that it use a different address for each. That way we are testing against simple cut and paste bugs where, for example, using --freezer X actually sets the reserve address.
test/scripts/e2e_subs/asset-misc.sh
Outdated
| if [ "$DMA_MANAGER_ADDRESS" = "$ACCOUNTB" ] \ | ||
| && [ "$DMA_RESERVE_ADDRESS" = "$ACCOUNT" ] \ | ||
| && [ "$DMA_FREEZE_ADDRESS" = "$ACCOUNT" ] \ | ||
| && [ "$DMA_CLAWBACK_ADDRESS" = "$ACCOUNT" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where I'd like to see different equality checks for each address.
cmd/goal/asset.go
Outdated
| if cmd.Flags().Changed("manager") { | ||
| assetManager = accountList.getAddressByName(assetManager) | ||
| manager = assetManager | ||
| } | ||
|
|
||
| if cmd.Flags().Changed("no-manager") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it would be nice to have a check to see if both "manager" is set, and "no-manager" is true, and if so, error out. (Same for others too.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. For the flag checks, I used cmd.Flags().Changed("manager") && cmd.Flags().Changed("no-manager") instead of cmd.Flags().Changed("manager") && assetNoManager because it looks nicer with two flags on the same line.... 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also use the variable for the manager flag directly, so you could do something as simple as assetManager != "" && assetNoManager without any use of cmd.Flags().Changed because they both have defaults set, so you would report the error if they both differ from their default.
I prefer to use the variables directly and only use Changed if I need to distinguish between when the switch gets its default value because it was not given on the command line, vs being given on the command-line, but being the same as the default. Here, the distinction does not matter.
cmd/goal/asset.go
Outdated
| reserve = assetReserve | ||
| } | ||
|
|
||
| if cmd.Flags().Changed("no-reserve") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A slightly simpler way to use boolean flags is to set the default to false (which you've already done), and then you don't need to use Changed(), you can just use the variable directly. See for example, how assetFrozen is used.
|
Oh, sorry, I missed that. Of course you need it.
…On Thu, Jan 6, 2022 at 12:44 PM Fionna Chan ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In test/scripts/e2e_subs/asset-misc.sh
<#3369 (comment)>:
> @@ -47,4 +47,44 @@ else
exit 1
fi
+# create asset with no manager, no freezer, and no clawback
+${gcmd} asset create --creator "${ACCOUNT}" --no-manager --no-freezer --no-clawback --name "${ASSET_NAME}" --unitname iamisc --total 1000000000000 --asseturl "${ASSET_URL}"
+
+IMMUTABLE_ASSET_ID=$(${gcmd} asset info --creator $ACCOUNT --unitname iamisc|grep 'Asset ID'|awk '{ print $3 }')
It was used for goal asset info to get the addresses. Is there a better
way to get them? :/
—
Reply to this email directly, view it on GitHub
<#3369 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADL7T5C7JRHKMSNOYSMMD3UUXIHZANCNFSM5LJHUACA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
|
I am seeing this with |
|
oh look.... Lines 611 to 615 in 52a1a2c
Lines 634 to 638 in 52a1a2c
|
Ok, good find. This is only what |
|
Oh, for testing the --no-reserve, you can actually check if the goal output contains |
jannotti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, pending CI checks. Thanks again!
|
merging this to a temp branch to kick off CI correctly. Thanks again for your contribution. |
|
This was merged as #3398 because we had a little CI hiccup. Thanks again. |
|
You're welcome~ |
Summary
Allow setting manager, reserve, freeze, and clawback at goal asset create
Test Plan
Did not test it.
I built the binaries, ran
${GOPATH}/bin/goal node start -d ~/.algorand, used goal to create a new wallet, but I don't know how to fund the wallet to continue :(Closes #3361