All notable changes to this project are documented in this file.
The format is based on Keep a Changelog. This project adheres to Semantic Versioning.
No unreleased changes yet
getActions
to handle multiple actions with multiple Account Updates o1-labs#801
- Use
fetchEvents()
to fetch events for a specified zkApp from a GraphQL endpoint that implements this schema.Mina.Network
accepts an additional endpoint which points to a GraphQL server. o1-labs#749- Use the
mina
property for the Mina node. - Use
archive
for the archive node.
- Use the
- Use
getActions
to fetch actions for a specified zkApp from a GraphQL endpoint GraphQL endpoint that implements the same schema asfetchEvents
. o1-labs#788
- Added the missing export of
Mina.TransactionId
o1-labs#785 - Added an option to specify
tokenId
asField
infetchAccount()
o1-labs#787
this.network.timestamp
is added back and is implemented on top ofthis.network.globalSlotSinceGenesis
o1-labs#755
- On-chain value
globalSlot
is replaced by the clearercurrentSlot
o1-labs#755currentSlot
refers to the slot at which the transaction will be included in a block.- the only supported method is
currentSlot.assertBetween()
becausecurrentSlot.get()
is impossible to implement since the value is determined in the future andcurrentSlot.assertEquals()
is error-prone
- Incorrect counting of limit on events and actions o1-labs#758
- Type error when using
Circuit.array
in on-chain state or events o1-labs#758 - Bug when using
Circuit.witness
outside the prover o1-labs#774
- Bug when using
this.<state>.get()
outside a transaction o1-labs#754
Transaction.fromJSON
to recover transaction object from JSON o1-labs#705- New precondition:
provedState
, a boolean which is true if the entire on-chain state of this account was last modified by a proof o1-labs#741- Same API as all preconditions:
this.account.provedState.assertEquals(Bool(true))
- Can be used to assert that the state wasn't tampered with by the zkApp developer using non-contract logic, for example, before deploying the zkApp
- Same API as all preconditions:
- New on-chain value
globalSlot
, to make assertions about the current time o1-labs#649- example:
this.globalSlot.get()
,this.globalSlot.assertBetween(lower, upper)
- Replaces
network.timestamp
,network.globalSlotSinceGenesis
andnetwork.globalSlotSinceHardFork
. o1-labs#560
- example:
- New permissions:
access
to control whether account updates for this account can be used at all o1-labs#500setTiming
to control who can update the account'stiming
field o1-labs#685- Example:
this.permissions.set({ ...Permissions.default(), access: Permissions.proofOrSignature() })
- Expose low-level view into the PLONK gates created by a smart contract method o1-labs#687
MyContract.analyzeMethods().<method name>.gates
- BREAKING CHANGE: Modify signature algorithm used by
Signature.{create,verify}
to be compatible with mina-signer o1-labs#710- Signatures created with mina-signer's
client.signFields()
can now be verified inside a SNARK! - Breaks existing deployed smart contracts which use
Signature.verify()
- Signatures created with mina-signer's
- BREAKING CHANGE: Circuits changed due to core protocol and cryptography changes; this breaks all deployed contracts.
- BREAKING CHANGE: Change structure of
Account
type which is returned byMina.getAccount()
o1-labs#741- for example,
account.appState
->account.zkapp.appState
- full new type (exported as
Types.Account
): https://github.com/o1-labs/snarkyjs/blob/0be70cb8ceb423976f348980e9d6238820758cc0/src/provable/gen/transaction.ts#L515
- for example,
- Test accounts hard-coded in
LocalBlockchain
now have default permissions, not permissions allowing everything. Fixes some unintuitive behaviour in tests, like requiring no signature when using these accounts to send MINA o1-labs#638
- Preconditions
timestamp
andglobalSlotSinceHardFork
o1-labs#560timestamp
is expected to come back as a wrapper for the newglobalSlot
this.account.<field>.set()
as a unified API to update fields on the account o1-labs#643- covers
permissions
,verificationKey
,zkappUri
,tokenSymbol
,delegate
,votingFor
- exists on
SmartContract.account
andAccountUpdate.account
- covers
this.sender
to get the public key of the transaction's sender o1-labs#652- To get the sender outside a smart contract, there's now
Mina.sender()
- To get the sender outside a smart contract, there's now
tx.wait()
is now implemented. It waits for the transactions inclusion in a block o1-labs#645wait()
also now takes an optionaloptions
parameter to specify the polling interval or maximum attempts.wait(options?: { maxAttempts?: number; interval?: number }): Promise<void>;
Circuit.constraintSystemFromKeypair(keypair)
to inspect the circuit at a low level o1-labs#529- Works with a
keypair
(prover + verifier key) generated with theCircuit
API
- Works with a
Mina.faucet()
can now be used to programmatically fund an address on the testnet, using the faucet provided by faucet.minaprotocol.com o1-labs#693
- BREAKING CHANGE: Constraint changes in
sign()
,requireSignature()
andcreateSigned()
onAccountUpdate
/SmartContract
. This means that smart contracts using these methods in their proofs won't be able to create valid proofs against old deployed verification keys. o1-labs#637 Mina.transaction
now takes a public key as the fee payer argument (passing in a private key is deprecated) o1-labs#652- Before:
Mina.transaction(privateKey, ...)
. Now:Mina.transaction(publicKey, ...)
AccountUpdate.fundNewAccount()
now enables funding multiple accounts at once, and deprecates theinitialBalance
argument
- Before:
- New option
enforceTransactionLimits
forLocalBlockchain
(default value:true
), to disable the enforcement of protocol transaction limits (maximum events, maximum sequence events and enforcing certain layout ofAccountUpdate
s depending on their authorization) o1-labs#620 - Change the default
send
permissions (for sending MINA or tokens) that get set when deploying a zkApp, fromsignature()
toproof()
o1-labs#648 - Functions for making assertions and comparisons have been renamed to their long form, instead of the initial abbreviation. Old function names have been deprecated o1-labs#681
.lt
->.lessThan
.lte
->.lessThanOrEqual
.gt
->.greaterThan
.gte
->greaterThanOrEqual
.assertLt
->.assertLessThan
.assertLte
->.assertLessThanOrEqual
.assertGt
->.assertGreaterThan
.assertGte
->assertGreaterThanOrEqual
.assertBoolean
->.assertBool
this.setPermissions()
in favor ofthis.account.permissions.set()
o1-labs#643this.tokenSymbol.set()
in favor ofthis.account.tokenSymbol.set()
this.setValue()
in favor ofthis.account.<field>.set()
Mina.transaction(privateKey: PrivateKey, ...)
in favor of new signatureMina.transaction(publicKey: PublicKey, ...)
AccountUpdate.createSigned(privateKey: PrivateKey)
in favor of new signatureAccountUpdate.createSigned(publicKey: PublicKey)
o1-labs#637.lt
,.lte
,gt
,gte
,.assertLt
,.assertLte
,.assertGt
,.assertGte
have been deprecated. o1-labs#681
- Fixed Apple silicon performance issue o1-labs#491
- Type inference for Structs with instance methods o1-labs#567
- also fixes
Struct.fromJSON
- also fixes
SmartContract.fetchEvents
fixed when multiple event types existed o1-labs#627- Error when using reduce with a
Struct
as state type o1-labs#689 - Fix use of stale cached accounts in
Mina.transaction
o1-labs#430
- Bug in
deploy()
when initializing a contract that already exists o1-labs#588
Mina.BerkeleyQANet
in favor of the clearer-namedMina.Network
o1-labs#588
MerkleMap
andMerkleMapWitness
o1-labs#546- Lots of doc comments! o1-labs#580
- Bug in
Circuit.log
printing account updates o1-labs#578
- Testnet-incompatible signatures in v0.7.0 o1-labs#565
- Added an optional string parameter to certain
assert
methods o1-labs#470 Struct
, a new primitive for declaring composite, SNARK-compatible types o1-labs#416- With this, we also added a way to include auxiliary, non-field element data in composite types
- Added
VerificationKey
, which is aStruct
with auxiliary data, to pass verification keys to a@method
- BREAKING CHANGE: Change names related to circuit types:
AsFieldsAndAux<T>
->Provable<T>
,AsFieldElement<T>
->ProvablePure<T>
,circuitValue
->provable
- BREAKING CHANGE: Change all
ofFields
andofBits
methods on circuit types tofromFields
andfromBits
- New option
proofsEnabled
forLocalBlockchain
(default value:true
), to quickly test transaction logic with proofs disabled o1-labs#462- with
proofsEnabled: true
, proofs now get verified locally o1-labs#423
- with
SmartContract.approve()
to approve a tree of child account updates o1-labs#428 o1-labs#534- AccountUpdates are now valid
@method
arguments, andapprove()
is intended to be used on them when passed to a method - Also replaces
Experimental.accountUpdateFromCallback()
- AccountUpdates are now valid
Circuit.log()
to easily log Fields and other provable types inside a method, with the same API asconsole.log()
o1-labs#484SmartContract.init()
is a new method on the baseSmartContract
that will be called only during the first deploy (not if you re-deploy later to upgrade the contract) o1-labs#543- Overriding
init()
is the new recommended way to add custom state initialization logic.
- Overriding
transaction.toPretty()
andaccountUpdate.toPretty()
for debugging transactions by printing only the pieces that differ from default account updates o1-labs#428AccountUpdate.attachToTransaction()
for explicitly adding an account update to the current transaction. This replaces some previous behaviour where an account update got attached implicitly o1-labs#484SmartContract.requireSignature()
andAccountUpdate.requireSignature()
as a simpler, better-named replacement for.sign()
o1-labs#558
- BREAKING CHANGE:
tx.send()
is now asynchronous: old:send(): TransactionId
new:send(): Promise<TransactionId>
andtx.send()
now directly waits for the network response, as opposed totx.send().wait()
o1-labs#423 - Sending transactions to
LocalBlockchain
now involves Circuit.witness
can now be called outside circuits, where it will just directly return the callback result o1-labs#484- The
FeePayerSpec
, which is used to specify properties of the transaction viaMina.transaction()
, now has another optional parameter to specify the nonce manually.Mina.transaction({ feePayerKey: feePayer, nonce: 1 }, () => {})
o1-labs#497 - BREAKING CHANGE: Static methods of type
.fromString()
,.fromNumber()
and.fromBigInt()
onField
,UInt64
,UInt32
andInt64
are no longer supported o1-labs#519- use
Field(number | string | bigint)
andUInt64.from(number | string | bigint)
- use
- Move several features out of 'experimental' o1-labs#555
Reducer
replacesExperimental.Reducer
MerkleTree
andMerkleWitness
replaceExperimental.{MerkleTree,MerkleWitness}
- In a
SmartContract
,this.token
replacesthis.experimental.token
CircuitValue
deprecated in favor ofStruct
o1-labs#416- Static props
Field.zero
,Field.one
,Field.minusOne
deprecated in favor ofField(number)
o1-labs#524 SmartContract.sign()
andAccountUpdate.sign()
in favor of.requireSignature()
o1-labs#558
- Uint comparisons and division fixed inside the prover o1-labs#503
- Callback arguments are properly passed into method invocations o1-labs#516
- Removed internal type
JSONValue
from public interfaces o1-labs#536 - Returning values from a zkApp o1-labs#461
- Callback arguments are properly passed into method invocations o1-labs#516
- Proof verification on the web version o1-labs#476
reducer.getActions
partially implemented for local testing o1-labs#327gte
andassertGte
methods onUInt32
,UInt64
o1-labs#349- Return sent transaction
hash
forRemoteBlockchain
o1-labs#399
- BREAKING CHANGE: Rename the
Party
class toAccountUpdate
. Also, rename other occurrences of "party" to "account update". o1-labs#393 - BREAKING CHANGE: Don't require the account address as input to
SmartContract.compile()
,SmartContract.digest()
andSmartContract.analyzeMethods()
o1-labs#406- This works because the address / public key is now a variable in the method circuit; it used to be a constant
- BREAKING CHANGE: Move
ZkProgram
toExperimental.ZkProgram
- Running snarkyjs inside a web worker o1-labs#378
- Infinite loop when compiling in web version o1-labs#379, by @maht0rz
- Crash of the web version introduced in 0.5.0
- Issue with
Experimental.MerkleWitness
o1-labs#368
fetchAccount
o1-labs#350
- Recursive proofs. RFC: o1-labs#89, PRs: o1-labs#245 o1-labs#250 o1-labs#261
- Enable smart contract methods to take previous proofs as arguments, and verify them in the circuit
- Add
ZkProgram
, a new primitive which represents a collection of circuits that produce instances of the same proof. So, it's a more general version ofSmartContract
, without any of the Mina-related API.
ZkProgram
is suitable for rollup-type systems and offchain usage of Pickles + Kimchi.
- zkApp composability -- calling other zkApps from inside zkApps. RFC: o1-labs#303, PRs: o1-labs#285, o1-labs#296, o1-labs#294, o1-labs#297
- Events support via
SmartContract.events
,this.emitEvent
. RFC: o1-labs#248, PR: o1-labs#272fetchEvents
partially implemented for local testing: o1-labs#323
- Payments:
this.send({ to, amount })
as an easier API for sending Mina from smart contracts o1-labs#325Party.send()
to transfer Mina between any accounts, for example, from users to smart contracts
SmartContract.digest()
to quickly compute a hash of the contract's circuit. This is used by the zkApp CLI to figure out whethercompile
should be re-run or a cached verification key can be used. o1-labs#268Circuit.constraintSystem()
for creating a circuit from a function, counting the number of constraints and computing a digest of the circuit o1-labs#279this.account.isNew
to assert that an account did not (or did) exist before the transaction MinaProtocol/mina#11524LocalBlockchain.setTimestamp
and other setters for network state, to test network preconditions locally o1-labs#329- Experimental APIs are now collected under the
Experimental
import, or onthis.experimental
in a smart contract. - Custom tokens (experimental), via
this.token
. RFC: o1-labs#233, PR: o1-labs#273, - Actions / sequence events support (experimental), via
Experimental.Reducer
. RFC: o1-labs#265, PR: o1-labs#274 - Merkle tree implementation (experimental) via
Experimental.MerkleTree
o1-labs#343
- BREAKING CHANGE: Make on-chain state consistent with other preconditions - throw an error when state is not explicitly constrained o1-labs#267
CircuitValue
improvements o1-labs#269, o1-labs#306, o1-labs#341- Added a base constructor, so overriding the constructor on classes that extend
CircuitValue
is now optional. When overriding, the base constructor can be called without arguments, as previously:super()
. When not overriding, the expected arguments are all the@prop
s on the class, in the order they were defined in:new MyCircuitValue(prop1, prop2)
. CircuitValue.fromObject({ prop1, prop2 })
is a new, better-typed alternative for using the base constructor.- Fixed: the overridden constructor is now free to have any argument structure -- previously, arguments had to be the props in their declared order. I.e., the behaviour that's now used by the base constructor used to be forced on all constructors, which is no longer the case.
- Added a base constructor, so overriding the constructor on classes that extend
Mina.transaction
improvements- Support zkApp proofs when there are other account updates in the same transaction block o1-labs#280
- Support multiple independent zkApp proofs in one transaction block o1-labs#296
- Add previously unimplemented preconditions, like
this.network.timestamp
o1-labs#324 MinaProtocol/mina#11577 - Improve error messages thrown from Wasm, by making Rust's
panic
log to the JS console MinaProtocol/mina#11644 - Not user-facing, but essential: Smart contracts fully constrain the account updates they create, inside the circuit o1-labs#278
- Fix comparisons on
UInt32
andUInt64
(UInt32.lt
,UInt32.gt
, etc) o1-labs#174, o1-labs#101. PR: o1-labs#307
- Implement the precondition RFC:
- new fields
this.account
andthis.network
on bothSmartContract
andParty
this.<account|network>.<property>.get()
to use on-chain values in a circuit, e.g. account balance or block heightthis.<account|network>.<property>.{assertEqual, assertBetween, assertNothing}()
to constrain what values to allow for these
- new fields
CircuitString
, a snark-compatible string type with methods like.append()
o1-labs#155bool.assertTrue()
,bool.assertFalse()
as convenient aliases for existing functionalityLedger.verifyPartyProof
which can check if a proof on a transaction is valid o1-labs#208- Memo field in APIs like
Mina.transaction
to attach arbitrary messages o1-labs#244 - This changelog
- Huge snark performance improvements (2-10x) for most zkApps MinaProtocol/mina#11053
- Performance improvements in node with > 4 CPUs, for all snarks MinaProtocol/mina#11292
- Substantial reduction of snarkyjs' size MinaProtocol/mina#11166
- Unused functions
call
andcallUnproved
, which were embryonic versions of what is now thetransaction
API to call smart contract methods - Some unimplemented fields on
SmartContract
- zkApp proving on web o1-labs#226