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

Chore/update ethers #188

Merged
merged 11 commits into from
Sep 27, 2023

Conversation

fermentfan
Copy link
Contributor

Long story short I update ethers and it was a pain.

@fermentfan
Copy link
Contributor Author

One to-do left is the whole lock file stuff. I commited a package-lock, but I guess you're still using yarn?

@mirceanis
Copy link
Member

One to-do left is the whole lock file stuff. I commited a package-lock, but I guess you're still using yarn?

Yes, yarn is still used here.
If we change it we'll probably go with pnpm instead of npm

Copy link
Member

@mirceanis mirceanis left a comment

Choose a reason for hiding this comment

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

@fermentfan yarn.lock must be updated and package-lock.json removed before this PR can be merged.

As it is, it is failing CI tests due to the lockfiles state.

That being said, I really appreciate the work you put into this task! The PR looks great

Copy link
Member

@mirceanis mirceanis left a comment

Choose a reason for hiding this comment

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

@fermentfan please remove the package-lock.json and update the yarn.lock file to be able to merge this PR

package-lock.json Outdated Show resolved Hide resolved
@fermentfan
Copy link
Contributor Author

@mirceanis tidied up the yarn stuff! Btw I didn't find any actual yarn version that you're targeting in that repository so I just installed the newest via NPM. Is this intended?

Copy link
Member

@mirceanis mirceanis left a comment

Choose a reason for hiding this comment

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

still a few nits to fix but looking great otherwise

{ chainId: 42, registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', name: 'kovan', legacyNonce: true },
{ chainId: 30, registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', name: 'rsk', legacyNonce: true },
{ chainId: 31, registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', name: 'rsk:testnet', legacyNonce: true },
{ chainId: BigInt(1), registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', name: 'mainnet', legacyNonce: true },
Copy link
Member

Choose a reason for hiding this comment

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

Configuration should not rely on types that are not usable in a json/yaml file.
While it is fine to accept bigint as an option, the default should remain a number or string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm... I definitely get the irritation around the bigint usage for chainIDs and I also don't 100% understand the decision to use it for that specific thing, but I'd not like to deviate from ethers there. It's their domain, which they own and there might be a good reason for it. Especially due to the behaviour of losing precision when reading very long integers from JSON into a javascript number that might lead to very intransparent problems. If the whole ecosystem moves with ethers you'd always need to translate it.

Thinking about this, one would also need to implement such logic (like reading the deployment configuration from a file) so why not solve this on that level then?

Copy link
Member

Choose a reason for hiding this comment

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

For the cases where the chainId would be too big to fit into a number, we still have the option of specifying it as a hex string. Do you have an example of such a network?

Since this is a config for ethr-did-resolver, it makes sense to have some logic for parsing it in this library instead of deferring to ethers.

As an example where such a config gets loaded from a file, we have the Veramo CLI.
In that case, the agent configuration is specified as a YML file which dynamically loads all the plugins specified in that file including their configs. That includes the configuration for this resolver where there is no opportunity to run any extra code on that level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pushed the alternative number configuration! please review :)

provider?: Provider
chainId?: string | number
provider?: Provider | null
chainId?: string | bigint
Copy link
Member

Choose a reason for hiding this comment

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

Please revert to using numbers.

It's fine to accept bigint, but numbers must be accepted to allow configs to be serialized to plain config files.

src/controller.ts Outdated Show resolved Hide resolved
src/controller.ts Outdated Show resolved Hide resolved
const cleanResults: (ERC1056Event | undefined)[] = results.filter((result) => result !== undefined)
// THIS IS THE GIGA HACK JUST TO REMOVE THE POSSIBLE UNDEFINED FROM THE ARRAY
// THAT IS INTRODUCED BY THE .MAP ABOVE
type cleanResult = Exclude<typeof results[0], undefined>
Copy link
Member

Choose a reason for hiding this comment

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

lol

@mirceanis
Copy link
Member

@mirceanis tidied up the yarn stuff! Btw I didn't find any actual yarn version that you're targeting in that repository so I just installed the newest via NPM. Is this intended?

I think it's yarn 1.x

Copy link
Member

@mirceanis mirceanis left a comment

Choose a reason for hiding this comment

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

Looks great, thank you for working on this!

@mirceanis mirceanis merged commit 2785e61 into decentralized-identity:master Sep 27, 2023
1 check passed
uport-automation-bot pushed a commit that referenced this pull request Sep 27, 2023
# [9.0.0](8.1.2...9.0.0) (2023-09-27)

### Bug Fixes

* **deps:** update ethers to v6 ([#188](#188)) ([2785e61](2785e61))

### BREAKING CHANGES

* **deps:** this update uses ethers v6 which has a sufficiently different API from v5 that will likely need attention. While the API of this library hasn't changed, it is likely that an update will need attention so this is marked as a breaking change and a new major version is released.
@uport-automation-bot
Copy link
Collaborator

🎉 This PR is included in version 9.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@fermentfan fermentfan deleted the chore/update-ethers branch September 27, 2023 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants