-
Notifications
You must be signed in to change notification settings - Fork 470
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
Update main.go #729
Update main.go #729
Conversation
Program bytes are needed for the Sign function
It looks like this change makes it so |
Compilation correction
The problem is that you can't use the output on a TEAL code to call ed25519verify. Maybe, we'll need another option of the same tool that generates the signature of the compiled program that can be used in a TEAL code. |
tools/teal/dkey/dsign/main.go
Outdated
@@ -62,8 +62,13 @@ func main() { | |||
ddata, err := ioutil.ReadFile(os.Args[3]) | |||
failFast(err) | |||
|
|||
programstr := fmt.Sprintf("%s", pdata) |
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.
Why using fmt.Sprintf
where fmt.Sprint
would do the work (notice no f
in function name)?
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'm using Sprint because I've got a byte[] containing a string (the code) and I want to create a string. The alternative is to use:
programstr := string(pdata)
Your proposed change doesn't work because it converts the byte[] to a string containing the binary codes (e.g.: '27 34 93 59') instead of a string with the TEAL code.
Simplified with typecast instead of Sprintf
I'm of the opinion that the |
It looks awesome, integrating it in goal is the correct way to do it. Thank
you!
…On Tue, Feb 11, 2020, 11:04 AM Derek Leung ***@***.***> wrote:
@pipaman <https://github.com/pipaman>, we decided to take your suggestion
and integrate this functionality into goal clerk tealsign. How does #800
<#800> look?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#729?email_source=notifications&email_token=ABJPPVS2XG3FDPXWST3EOXLRCKV5ZA5CNFSM4KJX2Z42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELMQTUA#issuecomment-584649168>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJPPVXNPAVA6HWUE6YWCL3RCKV5ZANCNFSM4KJX2Z4Q>
.
|
Program bytes are needed for the Sign function. It doesn't work with 4 parameters in this way since it doesn't verify when you call ed25519verify from teal. With this change, it does verify.
There is another issue I've noticed: when you pass a file as the data to sign, it is likely to have a special character in it, so the final signature includes this special character. I suggest making a string parameter version to avoid this problem.
Summary
Explain the goal of this change and what problem it is solving.
Test Plan
How did you test these changes? Please provide the exact scenarios you tested in as much detail as possible including commands, output and rationale.