Open janezpodhostnik opened 6 months ago
When trying to use the RLP builtin functions I got really confused.
This does not work:
import RLP //.... RLP.decodeString("...".utf8) //....
This also does not work:
// import RLP //.... decodeString("...".utf8) //....
But (confusingly) this works:
//import RLP //.... RLP.decodeString("...".utf8) //....
This is a bit confusing, and is not obvious from the docs: https://cadence-lang.org/docs/1.0/language/built-in-functions#rlp
Maybe add an example to the docs, or even allow the import RLP even if it is not doing anything.
import RLP
IMO, the best solution might actually be so that you have to import RLP...
I ran this in a go test env:
import RLP transaction(){ prepare(signer: auth(Storage, Contracts, Keys, Inbox, Capabilities) &Account) { var f: fun(): Void = fun(){} f = fun() { var i = 0 while i < 110 { i = i + 1 RLP.decodeString("xxxxxxxxxxxxxxxxxxxxxx".utf8) } } f() } execute { var f: fun(): Void = fun(){} } }
- Cadence version: 1.0 - Network: any
We should allow the import and not report an error.
This also applies to other contracts that are part of the standard library, e.g. BLS.
BLS
Current Behavior
When trying to use the RLP builtin functions I got really confused.
This does not work:
This also does not work:
But (confusingly) this works:
Expected Behavior
This is a bit confusing, and is not obvious from the docs: https://cadence-lang.org/docs/1.0/language/built-in-functions#rlp
Maybe add an example to the docs, or even allow the
import RLP
even if it is not doing anything.IMO, the best solution might actually be so that you have to import RLP...
Steps To Reproduce
I ran this in a go test env:
Environment