Skip to content

Conversation

@bitbeckers
Copy link
Collaborator

Updates the supported chains to support filecoin and filecoin calibration. Because of the JWT authentication of Glif the rpcFactory and evmClient builder were imported from the hypercerts-indexer.

Test were created and updated accordingly

@bitbeckers bitbeckers added the enhancement New feature or request label Jan 22, 2025
@bitbeckers bitbeckers requested a review from pheuberger January 22, 2025 14:28
@bitbeckers bitbeckers self-assigned this Jan 22, 2025
@github-actions
Copy link

github-actions bot commented Jan 22, 2025

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 25.53% (🎯 25%) 1089 / 4264
🟢 Statements 25.53% (🎯 25%) 1089 / 4264
🟢 Functions 63.04% (🎯 63%) 58 / 92
🟢 Branches 72.87% (🎯 72%) 180 / 247
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/client/chainFactory.ts 95.83% 80% 100% 95.83% 40
src/client/evmClient.ts 93.68% 100% 90.9% 93.68% 109-114
src/client/rpcClientFactory.ts 100% 100% 100% 100%
src/commands/CommandFactory.ts 0% 0% 0% 0% 1-31
src/commands/SafeApiCommand.ts 0% 0% 0% 0% 1-28
src/commands/UserUpsertCommand.ts 0% 0% 0% 0% 1-77
src/controllers/BlueprintController.ts 0% 0% 0% 0% 1-394
src/controllers/MarketplaceController.ts 0% 0% 0% 0% 1-492
src/lib/rpcProviders/customEthersJsonRpcProvider.ts 100% 100% 100% 100%
src/lib/safe/SafeApiKitStrategy.ts 0% 0% 0% 0% 1-46
src/lib/safe/safe-rpc-urls.ts 78.57% 60% 60% 78.57% 11-12, 21-22, 35-36
src/utils/constants.ts 100% 100% 100% 100%
src/utils/getTokenPriceInUSD.ts 0% 0% 0% 0% 1-213
src/utils/verifyAuthSignedData.ts 100% 100% 100% 100%
src/utils/waitForTxThenMintBlueprint.ts 0% 0% 0% 0% 1-32
Generated in workflow #44 for commit b6c826b by the Vitest Coverage Report Action

bitbeckers and others added 6 commits January 28, 2025 21:20
Updates the supported chains to support filecoin and filecoin
calibration. Because of the JWT authentication of Glif the rpcFactory
and evmClient builder were imported from the hypercerts-indexer.

Test were created and updated accordingly
For some reason the Safe provider didn't play nicely with the EIP1193
client and threw the following errors:

An unknown RPC error occurred.Details: request already sent
(operation="fetchRequest.send", code=UNSUPPORTED_OPERATION,
version=6.12.2)Version: [email protected]

This patch just goes back to the easy init method of providing an RPC
URL, to fix the issue.
For signature validations we need to make contract read calls. Safe
protocol kit expects an RPC URL to make these calls, but on Filecoin
mainnet and Filecoin Calibration they need to be JWT authenticated. This
poses a problem with the initializer of the Safe SDK so we decided to
use public RPCs on these two networks.
This is so that additional safe logic can be grouped into the safe
folder while keeping the signature verification logic in its own folder.
The type signature that's generated in types/supabaseData.ts claims that
chain_id is a number, while in reality it's a string.
Without this patch we solely rely on the Safe API Kit to figure out the
URL to the Safe Transaction Service. However, this doesn't work for
Filecoin Mainnet and Filecoin Calibration. These networks need an
explicit URL.
Removes the 1193 provider previously introduces as this is no longer
needed. Instead of providing the 1193 provider, we provide public RPCs
to the filecoin provider
@bitbeckers
Copy link
Collaborator Author

The support for signatures via Safes on FVM unfortunately doesn't work with this PR. The issue was raised with the FVM team and we're investigating.

Reported by @pheuberger in Telegram:

i'm running through the steps to get safe support working for filecoin. i'm getting stuck when trying to validate a 1 of 1 signature against the contract using protocol kit
here's the link to the messages: https://safe.filecoin.io/transactions/messages?safe=filecoin-calibration:0x78Ff82bAC5a2476f388cDb1FDE607cb9E8fbFdAD
and i'm calling protocolKit.isValidSignature() with the message hash and the signature (since it's 1 signer and a threshold of 1 it's just this one signature being passed)
... i’m also checking against the contract to be absolutely sure this is legitand that step is not working as expected

As a fast follow up to merging this PR, we should implement feature toggles in the FE ASAP so users won't run into the broken integration. Issue for feature toggles: hypercerts-org/hypercerts-app#349

As we want to progress with this PR, the test pipeline should be green.
However, we know the code isn't completely functional since the Safe
intergration on filecoin is still broken. So, enforcing full coverage of
the changes or continuity in the coverage doesn't make sense at this
moment.

All thresholds were reduces 1 percentage point. We'll manage.
Copy link
Contributor

@Jipperism Jipperism left a comment

Choose a reason for hiding this comment

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

Looks good to me, great we're following the same pattern with rpc clients everywhere now. Can't wait for hypercerts-org/internal-sdk 😅

@Jipperism Jipperism merged commit b42f283 into develop Jan 31, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

4 participants