Skip to content

Commit f7d522e

Browse files
Merge pull request #1938 from o1-labs/fix/update-network-id
Deprecate 'testnet' network id in favor of 'devnet'
2 parents 4e4692b + f9ab3ab commit f7d522e

22 files changed

+491
-37
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
4040

4141
- Compiling stuck in the browser for recursive zkprograms https://github.com/o1-labs/o1js/pull/1906
4242
- Error message in `rangeCheck16` gadget https://github.com/o1-labs/o1js/pull/1920
43+
- Deprecate `testnet` `networkId` in favor of `devnet` https://github.com/o1-labs/o1js/pull/1938
4344

4445
## [2.1.0](https://github.com/o1-labs/o1js/compare/b04520d...e1bac02) - 2024-11-13
4546

flake.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generate-keys.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22
import Client from './dist/node/mina-signer/mina-signer.js';
33

4-
let client = new Client({ network: 'testnet' });
4+
let client = new Client({ network: 'devnet' });
55

66
console.log(client.genKeys());

src/lib/mina/local-blockchain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async function LocalBlockchain({
106106
const originalProofsEnabled = proofsEnabled;
107107

108108
return {
109-
getNetworkId: () => 'testnet' as NetworkId,
109+
getNetworkId: () => 'devnet' as NetworkId,
110110
proofsEnabled,
111111
getNetworkConstants() {
112112
return {

src/lib/mina/mina-instance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ let activeInstance: Mina = {
117117
fetchActions: noActiveInstance,
118118
getActions: noActiveInstance,
119119
proofsEnabled: true,
120-
getNetworkId: () => 'testnet',
120+
getNetworkId: () => 'devnet',
121121
};
122122

123123
/**

src/lib/mina/mina.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function Network(
117117
}
118118
| string
119119
): Mina {
120-
let minaNetworkId: NetworkId = 'testnet';
120+
let minaNetworkId: NetworkId = 'devnet';
121121
let minaGraphqlEndpoint: string;
122122
let archiveEndpoint: string;
123123
let lightnetAccountManagerEndpoint: string;

src/lib/mina/token/forest-iterator.unit-test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
import assert from 'assert';
1717
import { Field, Bool } from '../../provable/wrapped.js';
1818
import { PublicKey } from '../../provable/crypto/signature.js';
19+
import { NetworkId } from '../../../mina-signer/index.js';
1920

2021
// RANDOM NUMBER GENERATORS for account updates
2122

@@ -56,7 +57,7 @@ test.custom({ timeBudget: 1000 })(
5657
(flatUpdatesBigint) => {
5758
// reference: bigint callforest hash from mina-signer
5859
let forestBigint = accountUpdatesToCallForest(flatUpdatesBigint);
59-
let expectedHash = callForestHash(forestBigint, 'testnet');
60+
let expectedHash = callForestHash(forestBigint, 'devnet');
6061

6162
let flatUpdates = flatUpdatesBigint.map(accountUpdateFromBigint);
6263
let forest = AccountUpdateForest.fromFlatArray(flatUpdates);

src/lib/provable/crypto/signature.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,22 +266,22 @@ class Signature extends CircuitValue {
266266
let publicKey = PublicKey.fromPrivateKey(privKey).toGroup();
267267
let d = privKey.s;
268268

269-
// we chose an arbitrary prefix for the signature, and it happened to be 'testnet'
269+
// we chose an arbitrary prefix for the signature
270270
// there's no consequences in practice and the signatures can be used with any network
271271
// if there needs to be a custom nonce, include it in the message itself
272272
let kPrime = Scalar.from(
273273
deriveNonce(
274274
{ fields: msg.map((f) => f.toBigInt()) },
275275
{ x: publicKey.x.toBigInt(), y: publicKey.y.toBigInt() },
276276
d.toBigInt(),
277-
'testnet'
277+
'devnet'
278278
)
279279
);
280280

281281
let { x: r, y: ry } = Group.generator.scale(kPrime);
282282
let k = ry.isOdd().toBoolean() ? kPrime.neg() : kPrime;
283283
let h = hashWithPrefix(
284-
signaturePrefix('testnet'),
284+
signaturePrefix('devnet'),
285285
msg.concat([publicKey.x, publicKey.y, r])
286286
);
287287
let e = Scalar.fromField(h);
@@ -296,11 +296,11 @@ class Signature extends CircuitValue {
296296
verify(publicKey: PublicKey, msg: Field[]): Bool {
297297
let point = publicKey.toGroup();
298298

299-
// we chose an arbitrary prefix for the signature, and it happened to be 'testnet'
299+
// we chose an arbitrary prefix for the signature
300300
// there's no consequences in practice and the signatures can be used with any network
301301
// if there needs to be a custom nonce, include it in the message itself
302302
let h = hashWithPrefix(
303-
signaturePrefix('testnet'),
303+
signaturePrefix('devnet'),
304304
msg.concat([point.x, point.y, this.r])
305305
);
306306

src/mina-signer/mina-signer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class Client {
152152
*/
153153
signFields(fields: bigint[], privateKey: Json.PrivateKey): Signed<bigint[]> {
154154
let privateKey_ = PrivateKey.fromBase58(privateKey);
155-
let signature = sign({ fields }, privateKey_, 'testnet');
155+
let signature = sign({ fields }, privateKey_, 'devnet');
156156
return {
157157
signature: Signature.toBase58(signature),
158158
publicKey: PublicKey.toBase58(PrivateKey.toPublicKey(privateKey_)),
@@ -172,7 +172,7 @@ class Client {
172172
Signature.fromBase58(signature),
173173
{ fields: data },
174174
PublicKey.fromBase58(publicKey),
175-
'testnet'
175+
'devnet'
176176
);
177177
}
178178

0 commit comments

Comments
 (0)