We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Reported by @sisyphusSmiling on Discord https://discord.com/channels/613813861610684416/1108479699732152503/1257730833352233131:
I ran into a really strange behaviour with the toConstantSized function. Take a look at this script: access(all) fun main(): [UInt8;20] { let hexStr = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" // 20-byte hex string let res = hexStr.decodeHex().toConstantSized<[UInt8;20]>() ?? panic("toConstantSized failed") return res } This panics every time, even though the cast should work. But, if I rewrite it like this: access(all) fun main(): [UInt8;20] { let hexStr = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" let res = hexStr.decodeHex().toConstantSized<[UInt8;20]>() let res2 = res ?? panic("toConstantSized failed") return res2 }
I ran into a really strange behaviour with the toConstantSized function. Take a look at this script:
access(all) fun main(): [UInt8;20] { let hexStr = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" // 20-byte hex string let res = hexStr.decodeHex().toConstantSized<[UInt8;20]>() ?? panic("toConstantSized failed") return res }
This panics every time, even though the cast should work. But, if I rewrite it like this:
access(all) fun main(): [UInt8;20] { let hexStr = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" let res = hexStr.decodeHex().toConstantSized<[UInt8;20]>() let res2 = res ?? panic("toConstantSized failed") return res2 }
Both scripts succeed
Use flow-c1 cadence script.cdc for the first script and it panics
flow-c1 cadence script.cdc
- Cadence version: Latest preview release (v1.0.0-preview.35) - Network: N/A
The text was updated successfully, but these errors were encountered:
turbolent
Successfully merging a pull request may close this issue.
Current Behavior
Reported by @sisyphusSmiling on Discord https://discord.com/channels/613813861610684416/1108479699732152503/1257730833352233131:
Expected Behavior
Both scripts succeed
Steps To Reproduce
Use
flow-c1 cadence script.cdc
for the first script and it panicsEnvironment
The text was updated successfully, but these errors were encountered: