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

Push to PRD #239

Merged
merged 13 commits into from
Feb 3, 2025
Merged

Push to PRD #239

merged 13 commits into from
Feb 3, 2025

Conversation

bitbeckers
Copy link
Collaborator

  • Filecoin chain and RPC support
  • SafeSignatureVerifier strategies
  • Fix in awaiting order deletion

bitbeckers and others added 13 commits January 31, 2025 15:50
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
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.
Fixes a regression introduced in
12f4e1f, which meant orders weren't
fetched/awaited correctly when deleting an order, resulting in 404's.
To support filecoin we need to bypass the SafeSDK to verify Safe
signatures. The SafeSignatureVerifier class was updated to support
different strategies based on chain ID. A SignatureVerifierFactory was
implemented to either execute a contract call or use the Safe SDK
depending on the provided chain ID.
…trategies

Implement contract signature verification
@bitbeckers bitbeckers self-assigned this Feb 3, 2025
@bitbeckers bitbeckers added the enhancement New feature or request label Feb 3, 2025
Copy link

github-actions bot commented Feb 3, 2025

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 25.35% (🎯 25%) 1097 / 4327
🟢 Statements 25.35% (🎯 25%) 1097 / 4327
🟢 Functions 61.05% (🎯 61%) 58 / 95
🟢 Branches 72.28% (🎯 72%) 180 / 249
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-493
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/lib/safe/signature-verification/SignatureVerifierStrategy.ts 12.5% 0% 0% 12.5% 17-27, 32-51, 55-83
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 #48 for commit 4d28567 by the Vitest Coverage Report Action

@bitbeckers bitbeckers merged commit 028f072 into main Feb 3, 2025
3 checks 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.

3 participants