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

make maxRetries func param & try direct submission if delegator sign … #2232

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

Intizar-T
Copy link
Contributor

Description

  • get maxRetries in SubmitDelegatedFallbackDirect as func argument
  • try direct tx submission if signing from delegator fails

Fixes #1906

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.

Deployment

  • Should publish npm package
  • Should publish Docker image

@Intizar-T Intizar-T self-assigned this Aug 26, 2024
@Intizar-T Intizar-T requested a review from a team as a code owner August 26, 2024 10:06
Copy link
Contributor

coderabbitai bot commented Aug 26, 2024

Walkthrough

Walkthrough

The changes to the SubmitDelegatedFallbackDirect function enhance its configurability by introducing a maxRetrial parameter, allowing callers to specify the maximum number of transaction retries. Additionally, the error handling logic is modified to immediately fallback to direct submission if signing with the delegator fails, instead of continuing to retry. These adjustments apply across multiple components, ensuring consistency in transaction handling.

Changes

Files Change Summary
node/pkg/chain/helper/helper.go Added maxRetrial parameter to SubmitDelegatedFallbackDirect, removed default value, and modified error handling logic to break on signing failure.
node/pkg/chain/helper/signer.go Introduced maxTxSubmissionRetries constant for use in signerUpdate, modifying its signature to pass this value to SubmitDelegatedFallbackDirect.
node/pkg/chain/tests/chain_test.go Updated test functions to include maxTxSubmissionRetries in calls to SubmitDelegatedFallbackDirect, enhancing standardization of retry behavior in tests.
node/pkg/por/app.go Added maxTxSubmissionRetries constant for configurable transaction submission retries in the report method.
node/pkg/reporter/reporter.go Introduced maxTxSubmissionRetries constant in report method, replacing hardcoded values for better maintainability.
node/script/test_dal_consumer/main.go Added maxTxSubmissionRetries constant for calls to kaiaHelper.SubmitDelegatedFallbackDirect, enhancing configurability of transaction submission.
node/script/test_submission/main.go Modified testContractFeeDelegatedCall function to include maxTxSubmissionRetries parameter in calls to kaiaHelper.SubmitDelegatedFallbackDirect, improving error handling and control over transaction submission attempts.

Assessment against linked issues

Objective Addressed Explanation
1. Take parameter for customizable max retrial (Issue #1906)
2. If error occurred on requesting sign from delegator, jump to direct submission (Issue #1906)

🐇 In code we hop and play,
New retries come into play!
If signing fails, we won’t delay,
Direct submission saves the day!
Configurable, neat, and bright,
Our transactions now take flight! 🌟


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 Configuration 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
Contributor

@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 a8f0693 and 9d447e2.

Files selected for processing (7)
  • node/pkg/chain/helper/helper.go (2 hunks)
  • node/pkg/chain/helper/signer.go (2 hunks)
  • node/pkg/chain/tests/chain_test.go (4 hunks)
  • node/pkg/por/app.go (2 hunks)
  • node/pkg/reporter/reporter.go (2 hunks)
  • node/script/test_dal_consumer/main.go (3 hunks)
  • node/script/test_submission/main.go (1 hunks)
Additional comments not posted (15)
node/script/test_submission/main.go (3)

13-14: LGTM!

The introduction of the maxTxSubmissionRetries constant enhances the configurability of the function.

The code changes are approved.


22-22: LGTM!

The function call to SubmitDelegatedFallbackDirect correctly includes the maxTxSubmissionRetries parameter.

The code changes are approved.


22-22: LGTM!

The call to testContractFeeDelegatedCall correctly includes the maxTxSubmissionRetries parameter.

The code changes are approved.

node/script/test_dal_consumer/main.go (3)

19-20: LGTM!

The introduction of the maxTxSubmissionRetries constant enhances the configurability of the function.

The code changes are approved.


77-77: LGTM!

The function call to SubmitDelegatedFallbackDirect correctly includes the maxTxSubmissionRetries parameter.

The code changes are approved.


90-90: LGTM!

The function call to SubmitDelegatedFallbackDirect correctly includes the maxTxSubmissionRetries parameter.

The code changes are approved.

node/pkg/reporter/reporter.go (2)

15-16: LGTM!

The introduction of the maxTxSubmissionRetries constant enhances the configurability of the function.

The code changes are approved.


140-140: LGTM!

The function call to SubmitDelegatedFallbackDirect correctly includes the maxTxSubmissionRetries parameter.

The code changes are approved.

node/pkg/chain/helper/signer.go (1)

240-240: LGTM!

The function correctly passes the new constant maxTxSubmissionRetries to SubmitDelegatedFallbackDirect.

The code changes are approved.

node/pkg/por/app.go (1)

214-214: LGTM!

The function correctly passes the new constant maxTxSubmissionRetries to SubmitDelegatedFallbackDirect.

The code changes are approved.

node/pkg/chain/helper/helper.go (1)

Line range hint 245-268: LGTM!

The function changes align with the PR objectives. The new parameter maxRetrial enhances configurability, and the updated error handling logic improves the efficiency of transaction submission.

The code changes are approved.

node/pkg/chain/tests/chain_test.go (4)

28-28: LGTM!

The introduction of the maxTxSubmissionRetries constant is consistent with the PR objective to make the maxRetries parameter configurable.

The code changes are approved.


271-271: LGTM!

The function call update to include the maxTxSubmissionRetries parameter aligns with the PR objective to enhance the configurability of the maxRetries parameter.

The code changes are approved.


295-295: LGTM!

The function call update to include the maxTxSubmissionRetries parameter in the concurrent test ensures consistency in the retry behavior for transaction submissions.

The code changes are approved.


774-774: LGTM!

The function call updates to include the maxTxSubmissionRetries parameter in the cleanup process ensure consistency in the retry behavior for transaction submissions.

The code changes are approved.

Also applies to: 779-779

@nick-bisonai
Copy link
Collaborator

lgtm!, before merging and deploying this, let's send some klay from delegator to reporter wallet so that it can work in case of delegator failure

Copy link
Collaborator

@nick-bisonai nick-bisonai left a comment

Choose a reason for hiding this comment

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

lgtm

@Intizar-T Intizar-T merged commit a9d6c98 into master Aug 27, 2024
2 checks passed
@Intizar-T Intizar-T deleted the feat/refactor-reporter-tx-submit-func branch August 27, 2024 03:52
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.

(OraklNode) Improve SubmitDelegatedFallbackDirect function
2 participants