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

Migrate utils/ JS files to TS #183

Merged
merged 12 commits into from
Feb 10, 2025
Merged

Conversation

gfournieriExec
Copy link
Contributor

  • Migrated utility files from JavaScript to TypeScript:
    • FactoryDeployer.jsFactoryDeployer.ts
    • constants.jsconstants.ts
    • odb-tools.jsodb-tools.ts
  • Removed deprecated ENS sidechain script
  • Added proper TypeScript type definitions

Copy link

codecov bot commented Feb 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.50%. Comparing base (7d936d4) to head (84a700e).
Report is 13 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #183   +/-   ##
========================================
  Coverage    84.50%   84.50%           
========================================
  Files           35       35           
  Lines         1084     1084           
  Branches       221      221           
========================================
  Hits           916      916           
  Misses         168      168           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

message: Record<string, any>,
domain: TypedDataDomain,
): string {
const typedDataDomain: TypedDataDomain = {

Choose a reason for hiding this comment

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

Suggested change
const typedDataDomain: TypedDataDomain = {
const typedDataDomain = {

This is a self-inferred type. It's useless to specify it. But we can keep it if you want

Copy link
Member

Choose a reason for hiding this comment

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

The goal is to enforce respecting properties of the type when constructing the object.

@@ -77,9 +87,9 @@ const TYPES = {
],
};

function buildTypes(primaryType) {
function buildTypes(primaryType: string): Types {

Choose a reason for hiding this comment

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

Suggested change
function buildTypes(primaryType: string): Types {
function buildTypes(primaryType: string) {

idem

const OPERATION = 'Operation';
const types = {
const types: Types = {

Choose a reason for hiding this comment

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

Suggested change
const types: Types = {
const types = {

idem

Comment on lines +12 to +14
interface Types {
[key: string]: Array<TypedDataField>;
}

Choose a reason for hiding this comment

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

Suggested change
interface Types {
[key: string]: Array<TypedDataField>;
}

This is a self-inferred type. It's useless to specify it. But we can keep it if you want

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually here is needed, and I prefer keeping it

await (await txPromise).wait();
}

export class EthersDeployer {

Choose a reason for hiding this comment

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

I'm not sure to understand the need for having a custom Deployer class. Why not use typechain Factories to deploy something ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well this file is just here to handle if the factory smart contract is deployed and if so get the address of the factory or deploy it correctly
We could change the architecture of EthersDeployer / FactoryDeployerHelper but it's not the purpose of this PR :)

Copy link
Member

Choose a reason for hiding this comment

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

Also a quick note, here the "Factory" is not the same thing as Typechain factories.
Here we use a generic factory deployer contract to deploy contracts at the same address cross-chains.

scripts/ens/sidechain.js Show resolved Hide resolved
utils/FactoryDeployer.ts Outdated Show resolved Hide resolved
utils/FactoryDeployer.ts Outdated Show resolved Hide resolved
utils/constants.ts Outdated Show resolved Hide resolved
utils/constants.ts Show resolved Hide resolved
if (wallet.address) {
signerPromise = hre.ethers.getSigner(wallet.address);
} else {
reject(new Error('Wallet address is undefined'));
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@zguesmi zguesmi left a comment

Choose a reason for hiding this comment

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

All good for me, thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for adding this file 🙏.
We can reference it in docs/README.md:

# ENS

Registered ENS names on Bellecour or Mainnet are documented in [./ENS-Addresses.md](./ENS-Addresses.md)

Copy link
Member

Choose a reason for hiding this comment

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

Do you think we can add addresses for each name?

Copy link
Member

@jeremyjams jeremyjams left a comment

Choose a reason for hiding this comment

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

Thank you!

- `core.v5.iexec.eth` - Core protocol proxy (ERC1538Proxy)
- `apps.v5.iexec.eth` - App registry contract
- `datasets.v5.iexec.eth` - Dataset registry contract
- `workerpools.v5.iexec.eth` - Workerpool registry contract
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- `workerpools.v5.iexec.eth` - Workerpool registry contract
- `workerpools.v5.iexec.eth` - Workerpool registry contract
To get more details, see [1_deploy-ens.ts script](deploy/1_deploy-ens.ts).

@Le-Caignec Le-Caignec self-requested a review February 10, 2025 14:06
@gfournieriExec gfournieriExec merged commit 0b0ac0a into develop Feb 10, 2025
4 checks passed
@gfournieriExec gfournieriExec deleted the feature/clean-utils-js-files branch February 12, 2025 09:03
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.

4 participants