Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ jobs:
needs: [Prepare]
timeout-minutes: 45
runs-on: ubuntu-latest
if: github.event.pull_request.base.ref != 'develop'
if: github.event.pull_request.base.ref == 'develop'
services:
mina-local-network:
image: o1labs/mina-local-network:master-latest-lightnet
Expand Down Expand Up @@ -355,7 +355,7 @@ jobs:
needs: [Prepare]
timeout-minutes: 45
runs-on: ubuntu-latest
if: github.event.pull_request.base.ref != 'develop'
if: github.event.pull_request.base.ref == 'main'
services:
mina-local-network:
image: o1labs/mina-local-network:compatible-latest-lightnet
Expand Down Expand Up @@ -421,4 +421,39 @@ jobs:
- name: Use shared steps for live testing jobs
uses: ./.github/actions/live-tests-shared
with:
mina-branch-name: develop
mina-branch-name: develop
mesa:
needs: [Prepare]
timeout-minutes: 45
runs-on: ubuntu-latest
if: github.event.pull_request.base.ref == 'develop-3.0'
services:
mina-local-network:
image: o1labs/mina-local-network:mesa-latest-lightnet
env:
NETWORK_TYPE: 'single-node'
PROOF_LEVEL: 'none'
ports:
- 3085:3085
- 5432:5432
- 8080:8080
- 8181:8181
- 8282:8282
volumes:
- /tmp:/root/logs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ inputs.target_repo || github.repository }}
ref: ${{ inputs.target_ref || github.ref }}
- name: build
uses: ./.github/actions/build
with:
repository: ${{ inputs.target_repo || github.repository }}
ref: ${{ inputs.target_ref || github.ref }}
proof_systems_commit: ${{ inputs.proof_systems_commit }}
- name: Use shared steps for live testing jobs
uses: ./.github/actions/live-tests-shared
with:
mina-branch-name: mesa
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ This project adheres to

## [Unreleased](https://github.com/o1-labs/o1js/compare/c2e51a84...HEAD)

### Removed
### Changed

- `Transaction.setFeePerSnarkCost` has been removed, since "snark cost" has been
removed in `mina`, replaced with `MAX_ZKAPP_SEGMENT_PER_TRANSACTION`,
simplifying calculations. Instead, use `setFee`.
simplifying calculations. Instead, use `setFeePerAccountUpdate`.

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion src/lib/mina/v1/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export namespace TransactionLimits {
}

export namespace ZkappConstants {
export const MAX_ZKAPP_STATE_FIELDS = 8 as const;
export const MAX_ZKAPP_STATE_FIELDS = 32 as const;
export const ACCOUNT_ACTION_STATE_BUFFER_SIZE = 5 as const;
export const ACCOUNT_CREATION_FEE = 1000000000n as const;
}
1 change: 1 addition & 0 deletions src/lib/mina/v1/local-blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ async function LocalBlockchain({ proofsEnabled = true, enforceTransactionLimits
errors,
transaction: txn.transaction,
setFee: txn.setFee,
setFeePerAccountUpdate: txn.setFeePerAccountUpdate,
hash,
toJSON: txn.toJSON,
toPretty: txn.toPretty,
Expand Down
31 changes: 14 additions & 17 deletions src/lib/mina/v1/mina-instance.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
/**
* This module holds the global Mina instance and its interface.
*/
import { Field } from '../../provable/wrapped.js';
import { UInt64, UInt32 } from '../../provable/int.js';
import type { NetworkId } from '../../../mina-signer/src/types.js';
import { PublicKey } from '../../provable/crypto/signature.js';
import { UInt32, UInt64 } from '../../provable/int.js';
import { Field } from '../../provable/wrapped.js';
import type { EventActionFilterOptions } from '././../../mina/v1/graphql.js';
import type { NetworkId } from '../../../mina-signer/src/types.js';
import type { Account } from './account.js';
import type { NetworkValue } from './precondition.js';
import type * as Fetch from './fetch.js';
import type { TransactionPromise, PendingTransactionPromise, Transaction } from './transaction.js';
import type { NetworkValue } from './precondition.js';
import type { PendingTransactionPromise, Transaction, TransactionPromise } from './transaction.js';

export {
Mina,
FeePayerSpec,
ActionStates,
FeePayerSpec,
Mina,
NetworkConstants,
defaultNetworkConstants,
activeInstance,
setActiveInstance,
ZkappStateLength,
currentSlot,
defaultNetworkConstants,
fetchActions,
fetchEvents,
getAccount,
hasAccount,
getActions,
getBalance,
getNetworkId,
getNetworkConstants,
getNetworkId,
getNetworkState,
fetchEvents,
fetchActions,
getActions,
getProofsEnabled,
hasAccount,
setActiveInstance,
};

const defaultAccountCreationFee = 1_000_000_000;
Expand All @@ -40,8 +39,6 @@ const defaultNetworkConstants: NetworkConstants = {
accountCreationFee: UInt64.from(defaultAccountCreationFee),
};

const ZkappStateLength = 8;

/**
* Allows you to specify information about the fee payer account and the transaction.
*/
Expand Down
29 changes: 23 additions & 6 deletions src/lib/mina/v1/mina.network.unit-test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { UInt64, Mina, AccountUpdate, PublicKey, Field, TokenId, PrivateKey } from 'o1js';
import { describe, it, before, beforeEach, afterEach } from 'node:test';
import { expect } from 'expect';
import { afterEach, before, beforeEach, describe, it } from 'node:test';
import { AccountUpdate, Field, Mina, PrivateKey, PublicKey, TokenId, UInt64 } from 'o1js';
import { TransactionLimits } from './constants.js';

const defaultNetwork = Mina.Network({
networkId: 'testnet',
Expand Down Expand Up @@ -69,7 +70,11 @@ describe('Test default network', () => {

it('More than limit account update', async () => {
let txn = await Mina.transaction(async () => {
for (let index = 0; index < 12; index++) {
for (
let index = 0;
index < TransactionLimits.MAX_ZKAPP_SEGMENT_PER_TRANSACTION + 1;
index++
) {
const accountUpdateBob = AccountUpdate.create(bobAccount, Field.from(index));
accountUpdateBob.account.balance.requireEquals(UInt64.zero);
accountUpdateBob.balance.addInPlace(UInt64.one);
Expand Down Expand Up @@ -114,7 +119,11 @@ describe('Test enforced network', () => {

it('More than limit account update', async () => {
let txn = await Mina.transaction(async () => {
for (let index = 0; index < 12; index++) {
for (
let index = 0;
index < TransactionLimits.MAX_ZKAPP_SEGMENT_PER_TRANSACTION + 1;
index++
) {
const accountUpdateBob = AccountUpdate.create(bobAccount, Field.from(index));
accountUpdateBob.account.balance.requireEquals(UInt64.zero);
accountUpdateBob.balance.addInPlace(UInt64.one);
Expand Down Expand Up @@ -159,7 +168,11 @@ describe('Test unlimited network', () => {

it('More than limit account update', async () => {
let txn = await Mina.transaction(async () => {
for (let index = 0; index < 12; index++) {
for (
let index = 0;
index < TransactionLimits.MAX_ZKAPP_SEGMENT_PER_TRANSACTION + 1;
index++
) {
const accountUpdateBob = AccountUpdate.create(bobAccount, Field.from(index));
accountUpdateBob.account.balance.requireEquals(UInt64.zero);
accountUpdateBob.balance.addInPlace(UInt64.one);
Expand Down Expand Up @@ -252,7 +265,11 @@ describe('Test network with headers', () => {

it('More than limit account update', async () => {
let txn = await Mina.transaction(async () => {
for (let index = 0; index < 12; index++) {
for (
let index = 0;
index < TransactionLimits.MAX_ZKAPP_SEGMENT_PER_TRANSACTION + 1;
index++
) {
const accountUpdateBob = AccountUpdate.create(bobAccount, Field.from(index));
accountUpdateBob.account.balance.requireEquals(UInt64.zero);
accountUpdateBob.balance.addInPlace(UInt64.one);
Expand Down
113 changes: 57 additions & 56 deletions src/lib/mina/v1/mina.ts
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
import { Test } from '../../../bindings.js';
import { Field } from '../../provable/wrapped.js';
import { UInt64 } from '../../provable/int.js';
import { PublicKey } from '../../provable/crypto/signature.js';
import { TokenId, Authorization } from './account-update.js';
import * as Fetch from './fetch.js';
import { humanizeErrors, invalidTransactionError } from './errors.js';
import { Types } from '../../../bindings/mina-transaction/v1/types.js';
import { Account } from './account.js';
import { NetworkId } from '../../../mina-signer/src/types.js';
import { currentTransaction } from './transaction-context.js';
import { PublicKey } from '../../provable/crypto/signature.js';
import { UInt64 } from '../../provable/int.js';
import { Field } from '../../provable/wrapped.js';
import { Authorization, TokenId } from './account-update.js';
import { Account } from './account.js';
import { humanizeErrors, invalidTransactionError } from './errors.js';
import * as Fetch from './fetch.js';
import { type EventActionFilterOptions } from './graphql.js';
import { LocalBlockchain, TestPublicKey } from './local-blockchain.js';
import {
type FeePayerSpec,
type ActionStates,
type NetworkConstants,
activeInstance,
setActiveInstance,
Mina,
defaultNetworkConstants,
activeInstance,
currentSlot,
defaultNetworkConstants,
fetchActions,
fetchEvents,
getAccount,
hasAccount,
getActions,
getBalance,
getNetworkId,
getNetworkConstants,
getNetworkId,
getNetworkState,
fetchEvents,
fetchActions,
getActions,
getProofsEnabled,
hasAccount,
setActiveInstance,
type ActionStates,
type FeePayerSpec,
type NetworkConstants,
} from './mina-instance.js';
import { type EventActionFilterOptions } from './graphql.js';
import { currentTransaction } from './transaction-context.js';
import {
defaultNetworkState,
filterGroups,
reportGetAccountError,
verifyTransactionLimits,
} from './transaction-validation.js';
import {
Transaction,
type PendingTransaction,
type IncludedTransaction,
type RejectedTransaction,
type PendingTransactionStatus,
type PendingTransactionPromise,
createIncludedTransaction,
createRejectedTransaction,
createTransaction,
toPendingTransactionPromise,
toTransactionPromise,
transaction,
createRejectedTransaction,
createIncludedTransaction,
toPendingTransactionPromise,
type IncludedTransaction,
type PendingTransaction,
type PendingTransactionPromise,
type PendingTransactionStatus,
type RejectedTransaction,
} from './transaction.js';
import {
reportGetAccountError,
verifyTransactionLimits,
defaultNetworkState,
filterGroups,
} from './transaction-validation.js';
import { LocalBlockchain, TestPublicKey } from './local-blockchain.js';

export {
ActionStates,
FeePayerSpec,
LocalBlockchain,
Network,
currentTransaction,
Transaction,
type PendingTransaction,
type IncludedTransaction,
type RejectedTransaction,
type PendingTransactionStatus,
type PendingTransactionPromise,
TestPublicKey,
Transaction,
activeInstance,
setActiveInstance,
transaction,
sender,
currentSlot,
currentTransaction,
faucet,
fetchActions,
fetchEvents,
// for internal testing only
filterGroups,
getAccount,
hasAccount,
getActions,
getBalance,
getNetworkId,
getNetworkConstants,
getNetworkId,
getNetworkState,
fetchEvents,
fetchActions,
getActions,
FeePayerSpec,
ActionStates,
faucet,
waitForFunding,
getProofsEnabled,
// for internal testing only
filterGroups,
hasAccount,
sender,
setActiveInstance,
transaction,
waitForFunding,
type IncludedTransaction,
type NetworkConstants,
type PendingTransaction,
type PendingTransactionPromise,
type PendingTransactionStatus,
type RejectedTransaction,
};

// patch active instance so that we can still create basic transactions without giving Mina network details
Expand Down Expand Up @@ -254,6 +254,7 @@ function Network(
errors: updatedErrors,
transaction: txn.transaction,
setFee: txn.setFee,
setFeePerAccountUpdate: txn.setFeePerAccountUpdate,
hash,
toJSON: txn.toJSON,
toPretty: txn.toPretty,
Expand Down
Loading
Loading