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

Execute prompt uses webauthn insteaf of session #465

Merged
merged 1 commit into from
Jul 11, 2024
Merged

Conversation

broody
Copy link
Contributor

@broody broody commented Jul 11, 2024

If dapp doesn't include a method in policy then we'll prompt for execution, flow will be webauthn instead of session. However, for webauthn to have accurate estimated fees validation can't be skipped, this forces webauthn to prompt twice - once for estimate fee and then for actual invoke txn.

Hardcoding the maxfee for webauthn flow for now. Proper solution is to calculate webauthn validation cost separately and add it to estimated fee with skipped validation.

Summary by CodeRabbit

  • Bug Fixes
    • Updated fee calculation logic in the Execute component to use ETH_MIN_PREFUND for more accurate transaction fee estimation.

Copy link

vercel bot commented Jul 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
cartridge-starknet-react-next ✅ Ready (Inspect) Visit Preview Jul 11, 2024 4:47pm
docs ✅ Ready (Inspect) Visit Preview Jul 11, 2024 4:47pm
keychain ✅ Ready (Inspect) Visit Preview Jul 11, 2024 4:47pm
ui ✅ Ready (Inspect) Visit Preview Jul 11, 2024 4:47pm
ui-next ✅ Ready (Inspect) Visit Preview Jul 11, 2024 4:47pm

Copy link

coderabbitai bot commented Jul 11, 2024

Walkthrough

The recent modifications to the Execute component primarily involve updating import statements and the calculation of maxFee. Instead of using ESTIMATE_FEE_MULTIPLIER, the component now imports ETH_MIN_PREFUND and calculates maxFee based on this new value. Additionally, the code now imports num from the starknet library. The maxFee is then directly used in the account.execute call within the onSubmit function.

Changes

File Path Change Summary
packages/keychain/src/components/Execute/... Updated imports to use ETH_MIN_PREFUND from "utils/token" and num from "starknet".
packages/keychain/src/components/Execute/... Modified onSubmit function to calculate maxFee using ETH_MIN_PREFUND and pass it to account.execute.

Poem

In the realm of Execute, changes are afoot,
With ETH_MIN_PREFUND, our fee's now well put.
No more ESTIMATE to muddy the flow,
Precise and clear, like a river's steady glow.
Hopping along, our code's now bright,
A bunny's delight in the summer's soft light. 🌟🐰


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bac1979 and 23a4203.

Files selected for processing (1)
  • packages/keychain/src/components/Execute/index.tsx (2 hunks)
Additional comments not posted (2)
packages/keychain/src/components/Execute/index.tsx (2)

20-21: Imports look good!

The new imports ETH_MIN_PREFUND and num are necessary for the modifications in the onSubmit function.


117-122: Ensure accurate fee calculation.

The changes correctly use ETH_MIN_PREFUND as a fallback for maxFee. However, the TODO comment indicates that calculating WebAuthn validation cost separately is a future improvement.

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.

1 participant