-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate 'testnet' network id in favor of 'devnet' #1938
Changes from 7 commits
d68b785
526881d
28ea4f9
53abba6
ddb1d66
fa811ab
8d68f23
4b926ea
79f1fd1
92dd1a3
b926974
3fdc3f1
0681caa
01a307f
1aab7bb
f9ab3ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env node | ||
import Client from './dist/node/mina-signer/mina-signer.js'; | ||
|
||
let client = new Client({ network: 'testnet' }); | ||
let client = new Client({ network: 'devnet' }); | ||
|
||
console.log(client.genKeys()); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ export { | |
}; | ||
|
||
const networkIdMainnet = 0x01n; | ||
const networkIdTestnet = 0x00n; | ||
const networkIdDevnet = 0x00n; | ||
|
||
type Signature = { r: Field; s: Scalar }; | ||
type SignatureJson = { field: string; scalar: string }; | ||
|
@@ -111,7 +111,7 @@ function verifyFieldElement( | |
* @param privateKey The `privateKey` represents an element of the Pallas scalar field, and should be given as a native bigint. | ||
* It can be converted from the base58 string representation using {@link PrivateKey.fromBase58}. | ||
* | ||
* @param networkId The `networkId` is either "testnet" or "mainnet" and ensures that testnet transactions can | ||
* @param networkId The `networkId` is either "devnet"/"testnet" or "mainnet" and ensures that testnet transactions can | ||
hattyhattington17 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* never be used as valid mainnet transactions. | ||
* | ||
* @see {@link deriveNonce} and {@link hashMessage} for details on how the nonce and hash are computed. | ||
|
@@ -331,8 +331,9 @@ function getNetworkIdHashInput(network: NetworkId): [bigint, number] { | |
switch (s) { | ||
case 'mainnet': | ||
return [networkIdMainnet, 8]; | ||
case 'devnet': | ||
case 'testnet': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a deprecation warning here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you thinking a log statement or a comment? It's a bit noisy during tests with the log There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking a log... why is it noisy? Because we have tests still using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no logs from library code please! |
||
return [networkIdTestnet, 8]; | ||
return [networkIdDevnet, 8]; | ||
default: | ||
return networkIdOfString(s); | ||
} | ||
|
@@ -356,6 +357,7 @@ const signaturePrefix = (network: NetworkId) => { | |
switch (s) { | ||
case 'mainnet': | ||
return prefixes.signatureMainnet; | ||
case 'devnet': | ||
case 'testnet': | ||
return prefixes.signatureTestnet; | ||
default: | ||
|
@@ -368,6 +370,7 @@ const zkAppBodyPrefix = (network: NetworkId) => { | |
switch (s) { | ||
case 'mainnet': | ||
return prefixes.zkappBodyMainnet; | ||
case 'devnet': | ||
case 'testnet': | ||
return prefixes.zkappBodyTestnet; | ||
default: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,62 @@ let strings = [ | |
* - the 3 strings. | ||
*/ | ||
let signatures: { [k: string]: { field: string; scalar: string }[] } = { | ||
devnet: [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: we could save a few lines here since devnet and testnet are the same payload anyway |
||
{ | ||
field: | ||
'3925887987173883783388058255268083382298769764463609405200521482763932632383', | ||
scalar: | ||
'445615701481226398197189554290689546503290167815530435382795701939759548136', | ||
}, | ||
{ | ||
field: | ||
'11838925242791061185900891854974280922359055483441419242429642295065318643984', | ||
scalar: | ||
'5057044820006008308046028014628135487302791372585541488835641418654652928805', | ||
}, | ||
{ | ||
field: | ||
'13570419670106759824217358880396743605262660069048455950202130815805728575057', | ||
scalar: | ||
'2256128221267944805514947515637443480133552241968312777663034361688965989223', | ||
}, | ||
{ | ||
field: | ||
'18603328765572408555868399359399411973012220541556204196884026585115374044583', | ||
scalar: | ||
'17076342019359061119005549736934690084415105419939473687106079907606137611470', | ||
}, | ||
{ | ||
field: | ||
'1786373894608285187089973929748850875336413409295396991315429715474432640801', | ||
scalar: | ||
'10435258496141097615588833319454104720521911644724923418749752896069542389757', | ||
}, | ||
{ | ||
field: | ||
'11710586766419351067338319607483640291676872446372400739329190129174446858072', | ||
scalar: | ||
'21663533922934564101122062377096487451020504743791218020915919810997397884837', | ||
}, | ||
{ | ||
field: | ||
'11583775536286847540414661987230057163492736306749717851628536966882998258109', | ||
scalar: | ||
'14787360096063782022566783796923142259879388947509616216546009448340181956495', | ||
}, | ||
{ | ||
field: | ||
'24809097509137086694730479515383937245108109696879845335879579016397403384488', | ||
scalar: | ||
'23723859937408726087117568974923795978435877847592289069941156359435022279156', | ||
}, | ||
{ | ||
field: | ||
'23803497755408154859878117448681790665144834176143832235351783889976460433296', | ||
scalar: | ||
'21219917886278462345652813021708727397787183083051040637716760620250038837684', | ||
}, | ||
], | ||
testnet: [ | ||
{ | ||
field: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where constants used during signing are set, changing the networkId to devnet will not change the underlying constants so the signatures themselves will not be changed