You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public async getFungibleToken(): Promise<FungibleToken> {
const _fungibleToken = await Provable.witnessAsync(PublicKey, async () => {
let pk = await this.fungibleToken.fetch()
assert(pk !== undefined, "fungible token not found")
return pk
});
this.fungibleToken.requireEquals(_fungibleToken);
return (new Crowdfunding.FungibleTokenContract(_fungibleToken));
}
x.toConstant() was called on a variable field element x in provable code.
This is not supported, because variables represent an abstract computation,
which only carries actual values during proving, but not during compiling.
Also, reading out JS values means that whatever you're doing with those values will no longer be
linked to the original variable in the proof, which makes this pattern prone to security holes.
You can check whether your field element is a variable or a constant by using x.isConstant().
To inspect values for debugging, use Provable.log(x). For more advanced use cases,
there is `Provable.asProver(() => { ... })` which allows you to use x.toConstant() inside the callback.
Warning: whatever happens inside asProver() will not be part of the zk proof.
37 | public async getFungibleToken(): Promise<FungibleToken> {
38 | const _fungibleToken = await Provable.witnessAsync(PublicKey, async () => {
> 39 | let pk = await this.fungibleToken.fetch()
| ^
40 | assert(pk !== undefined, "fungible token not found")
41 | return pk
42 | });
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
x.toConstant() was called on a variable field element
x
in provable code.This is not supported, because variables represent an abstract computation,
which only carries actual values during proving, but not during compiling.
Beta Was this translation helpful? Give feedback.
All reactions