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

ZDC Update for Multi Chain #120

Open
wants to merge 19 commits into
base: multi-zns-proto
Choose a base branch
from

Conversation

Whytecrowe
Copy link
Collaborator

@Whytecrowe Whytecrowe commented Nov 27, 2024

rc/multi-zns-main or multi-zns-proto (after merge with the former) needs to be merged into this branch to update the code with all the previous changes !!!

@Whytecrowe Whytecrowe changed the base branch from development to multi-zns-proto November 27, 2024 01:45
Copy link

openzeppelin-code bot commented Nov 27, 2024

ZDC Update for Multi Chain

Generated at commit: 53135bc0e29b22e12c3881dde6e24a9a7c1f7dc2

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
3
2
0
2
21
28
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

Copy link

codecov bot commented Dec 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.62%. Comparing base (17e8387) to head (53135bc).

Additional details and impacted files
@@                 Coverage Diff                 @@
##           multi-zns-proto     #120      +/-   ##
===================================================
+ Coverage            94.93%   95.62%   +0.68%     
===================================================
  Files                   19       19              
  Lines                  731      731              
  Branches               166      166              
===================================================
+ Hits                   694      699       +5     
+ Misses                  37       32       -5     

env ?: TEnvironment;
}) : Promise<IZNSCampaignConfig> => {
// Prioritize reading from the env variable first, and only then fallback to the param
let envLevel = process.env.ENV_LEVEL as TEnvironment;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could simplify this and any other null checks with const envLevel = env ?? process.env.ENV_LEVEL; or the opposite order.

Also this seems a bit odd because it will read ENV_LEVEL but it will always fallback to env if specified, but from your comment it sounds like it should only fallback to env if the env var wasn't found in the system with process.env.ENV_LEVEL

@@ -93,7 +103,9 @@ export const getConfig = async ({
}

// Domain Token Values
const royaltyReceiver = process.env.ENV_LEVEL !== "dev" ? process.env.ROYALTY_RECEIVER! : zeroVaultAddressConf;
const royaltyReceiver = process.env.ENV_LEVEL !== EnvironmentLevels.dev
Copy link
Collaborator

@JamesEarle JamesEarle Dec 18, 2024

Choose a reason for hiding this comment

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

we could do else if above and it would feel cleaner than checking twice and separately

@@ -82,7 +92,7 @@ export const getConfig = async ({

let zeroVaultAddressConf : string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

small nitpick, but what is the Conf suffix adding here? Makes me think this is a config, but it's just a single value. I would just use zeroVaultAddress

export const buildCrosschainConfig = (env : TEnvironment) : {
crosschain : TZNSCrossConfig;
srcChainName : TSupportedChain;
} => {
const srcChainName = process.env.SRC_CHAIN_NAME as TSupportedChain;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This won't actually cause an error if proess.env.SRC_CHAIN_NAME is not one of the one's included in TSupportedChain, the as in TypeScript is basically telling the transpiler "even if this isn't what I type it as, don't complain because I know what I'm doing"

It will be fine though because your switch below checks for exact values

@@ -275,5 +305,5 @@ export const buildCrosschainConfig = () : TZNSCrossConfig => {
throw new Error(`Unsupported chain: ${srcChainName}!`);
}

return crossConfig;
return { crosschain: crossConfig, srcChainName };
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not just use the name of the variable you're returning when you declare it above for simplicity? or change the return variable name to match? seems like a needless thing to have one prop named the return value and one not

@@ -39,13 +36,14 @@ export interface IZNSEthCrossConfig extends IZNSBaseCrossConfig {

export interface IZNSZChainCrossConfig extends IZNSBaseCrossConfig {
srcZnsPortal : string;
ethAdmin ?: IZNSSigner;
}

export type TZNSCrossConfig = IZNSEthCrossConfig | IZNSZChainCrossConfig;
Copy link
Collaborator

Choose a reason for hiding this comment

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

small nitpick, but it feels redundant to start every custom type with T, we know they are a type by the way we reference it

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.

2 participants