Skip to content
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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

hattyhattington17
Copy link

@hattyhattington17 hattyhattington17 commented Dec 3, 2024

Deprecates the testnet network id in favor of devnet. Functionality is unchanged and testnet can still be used with the same behavior as devnet.

@dfstio
Copy link

dfstio commented Dec 4, 2024

Will this change break the verification keys of the contracts deployed now on devnet, including FungibleToken contracts?

@Trivo25
Copy link
Member

Trivo25 commented Dec 4, 2024

Will this change break the verification keys of the contracts deployed now on devnet, including FungibleToken contracts?

This is only a cosmetic change in order to agree on a common name for the network throughout the codebases. Under the hood we still use the same prefixes (unless its a custom network id)

@@ -44,7 +44,7 @@ export {
};

const networkIdMainnet = 0x01n;
const networkIdTestnet = 0x00n;
Copy link
Author

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

@hattyhattington17 hattyhattington17 marked this pull request as ready for review December 4, 2024 16:20
@hattyhattington17 hattyhattington17 requested review from a team as code owners December 4, 2024 16:20
Copy link
Member

@Geometer1729 Geometer1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@45930 45930 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing we could consider in the future would be defining constant types and using those types throughout the code instead of string literals. Then we could update the actual string associated with the type more easily if we ever need to again.

const NetworkIds = {
  Mainnet: 'mainnet',
  Devnet: 'devnet',
  /**
     * @deprecated This network id is deprecated. Use `Devnet` instead.
     */
  Testnet: 'testnet'
} as const;

type NetworkId = typeof NetworkIds[keyof typeof NetworkIds] | { custom: string }

This also gives us a nice devX for deprecations:

image

src/mina-signer/src/signature.ts Outdated Show resolved Hide resolved
@@ -331,8 +331,9 @@ function getNetworkIdHashInput(network: NetworkId): [bigint, number] {
switch (s) {
case 'mainnet':
return [networkIdMainnet, 8];
case 'devnet':
case 'testnet':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a deprecation warning here?

Copy link
Author

Choose a reason for hiding this comment

The 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

Copy link
Contributor

Choose a reason for hiding this comment

The 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 testnet? I suppose we can do a very soft deprecation for now and continue to fully support testnet, but eventually we will want to remove it from our tests.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no logs from library code please!

@@ -91,6 +91,62 @@ let strings = [
* - the 3 strings.
*/
let signatures: { [k: string]: { field: string; scalar: string }[] } = {
devnet: [
Copy link
Member

Choose a reason for hiding this comment

The 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants