o1js icon indicating copy to clipboard operation
o1js copied to clipboard

`PublicKey.assertEquals` doesn't allow giving a 2nd parameter for an error message

Open berzanorg opened this issue 1 year ago • 0 comments

All the other built-in provable data structures allow setting an error message for assertions.

But PublicKey.assertEquals(other, msg) doesn't work, whereas UInt64.assertEquals(other, msg) works.

Currently I'm achieving the same with PublicKey.equals(other).assertTrue(msg)

Is there a specific reason for it not to work?

If not, being able to set an error message would be great.

Code Sample

import { PrivateKey } from "o1js"

const berzanPublicKey = PrivateKey.random().toPublicKey()
const johnPublicKey = PrivateKey.random().toPublicKey()

berzanPublicKey.assertEquals(johnPublicKey, "blabla blabla") // it doesn't allow a 2nd parameter
berzanPublicKey.equals(johnPublicKey).assertTrue("blabla blabla") // with this way it works

berzanorg avatar Feb 02 '24 15:02 berzanorg