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

fix(sdkclient): acc sequence setting #2375

Merged
merged 3 commits into from
Jan 3, 2024
Merged

Conversation

robert-zaremba
Copy link
Member

@robert-zaremba robert-zaremba commented Jan 2, 2024

Description

Summary by CodeRabbit

  • Refactor

    • Updated account sequence handling in client operations.
    • Separated account sequence setting from transaction broadcasting logic.
  • Tests

    • Adjusted end-to-end tests to accommodate changes in account sequence handling methods.

@robert-zaremba robert-zaremba requested a review from a team as a code owner January 2, 2024 22:40
Copy link
Contributor

coderabbitai bot commented Jan 2, 2024

Walkthrough

The codebase has undergone a refactoring where the method WithAccSeq is now replaced by SetAccSeq. This change affects how the account sequence is managed within the Client structure, implying a more explicit and possibly more controlled way of setting the account sequence before transactions are broadcasted.

Changes

File Path Change Summary
client/client.go, sdkclient/tx/client.go Replaced WithAccSeq with SetAccSeq, updating method calls and logic for account sequence handling.
sdkclient/tx/wasm.go Altered execution logic for contracts to separate setting of account sequence from transaction broadcasting.
tests/e2e/setup/utils.go Updated BroadcastTxWithRetry to use SetAccSeq instead of WithAccSeq, changing the function's logic.

Poem

In the land of code, where the data rabbits hop,
A change was made, WithAccSeq had to stop.
🎩✨ Now SetAccSeq reigns, with a logic so neat,
Sequence set with care before the tx's heartbeat.

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 with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid.
    • @coderabbitai read the files in the src/scheduler package and generate README in the markdown format.

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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

codecov bot commented Jan 2, 2024

Codecov Report

Attention: 98 lines in your changes are missing coverage. Please review.

Comparison is base (7f05ad4) 75.38% compared to head (6f1c7b7) 70.03%.
Report is 334 commits behind head on main.

❗ Current head 6f1c7b7 differs from pull request most recent head 61c1cc2. Consider uploading reports for the commit 61c1cc2 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2375      +/-   ##
==========================================
- Coverage   75.38%   70.03%   -5.36%     
==========================================
  Files         100      174      +74     
  Lines        8025    13027    +5002     
==========================================
+ Hits         6050     9123    +3073     
- Misses       1589     3299    +1710     
- Partials      386      605     +219     
Files Coverage Δ
ante/ante.go 66.66% <100.00%> (+18.45%) ⬆️
ante/fee.go 80.00% <100.00%> (+1.64%) ⬆️
ante/spam_prevention.go 75.92% <ø> (ø)
app/inflation/inflation.go 100.00% <100.00%> (ø)
app/upgradev3/migrations.go 84.21% <ø> (+5.94%) ⬆️
util/coin/utoken.go 100.00% <100.00%> (ø)
util/genmap/genmap.go 100.00% <100.00%> (ø)
util/ibc/ibc.go 58.82% <ø> (ø)
util/sdkutil/events.go 0.00% <ø> (ø)
util/store/iter.go 36.00% <ø> (-0.37%) ⬇️
... and 40 more

... and 114 files with indirect coverage changes

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d6e83ee and 5c579b8.
Files selected for processing (4)
  • client/client.go (1 hunks)
  • sdkclient/tx/client.go (1 hunks)
  • sdkclient/tx/wasm.go (1 hunks)
  • tests/e2e/setup/utils.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • client/client.go
Additional comments: 3
sdkclient/tx/wasm.go (1)
  • 50-53: The separation of setting the account sequence from the transaction broadcasting logic using SetAccSeq is a logical change. Ensure that SetAccSeq is correctly implemented and that the account sequence is being used correctly in the BroadcastTx method.
sdkclient/tx/client.go (1)
  • 141-142: The modification to SetAccSeq to directly set the account sequence in the txFactory is consistent with the PR objectives. Verify that the txFactory is correctly updated and that no other parts of the code rely on the old behavior of returning a new Client instance.
Verification successful

To verify the usage of WithAccSeq in tests/util/cw_util.go and sdkclient/tx/wasm.go, we will look at the method definitions and usages in these files to understand if they have been updated or if they are separate concerns.


The analysis of tests/util/cw_util.go and sdkclient/tx/wasm.go files indicates that:

  • The WasmExecContractWithAccSeq method in sdkclient/tx/wasm.go has been updated to use the new SetAccSeq method, aligning with the PR's objectives.
  • The test utility methods CWExecuteWithSeqAndAsync and CWExecuteWithSeqAndAsyncResp in tests/util/cw_util.go are using the updated WasmExecContractWithAccSeq method, ensuring consistency with the new changes.

Therefore, the remaining references to WithAccSeq are not an issue as they have been properly updated to work with the new method.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that no other parts of the code rely on the old WithAccSeq method.
rg --type go 'WithAccSeq'

Length of output: 436



Script:

#!/bin/bash
# Check the method definitions and usages of WithAccSeq in tests/util/cw_util.go
cat tests/util/cw_util.go

# Check the method definitions and usages of WithAccSeq in sdkclient/tx/wasm.go
cat sdkclient/tx/wasm.go

Length of output: 5172

tests/e2e/setup/utils.go (1)
  • 314-314: The change from WithAccSeq to SetAccSeq in the BroadcastTxWithRetry function aligns with the PR objectives. Verify that the function correctly handles the account sequence and that the retry logic is still valid.

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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5c579b8 and 6f1c7b7.
Files selected for processing (1)
  • CHANGELOG.md (1 hunks)

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@gsk967 gsk967 left a comment

Choose a reason for hiding this comment

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

CHANGELOG.md Outdated Show resolved Hide resolved
@robert-zaremba robert-zaremba added the skip-e2e-test Skip the e2e tests label Jan 3, 2024
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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6f1c7b7 and 61c1cc2.
Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional comments: 1
CHANGELOG.md (1)
  • 70-70: The API Breaking change is correctly documented.

CHANGELOG.md Show resolved Hide resolved
@robert-zaremba robert-zaremba added this pull request to the merge queue Jan 3, 2024
Merged via the queue into main with commit 16e06f8 Jan 3, 2024
23 of 36 checks passed
@robert-zaremba robert-zaremba deleted the robert/fix-client-factory branch January 3, 2024 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-e2e-test Skip the e2e tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants