Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

fix(sdb): CreateAccount should check for existence before creating. #1243

Merged
merged 1 commit into from
Oct 22, 2023

Conversation

itsdevbear
Copy link
Member

@itsdevbear itsdevbear commented Oct 22, 2023

Summary by CodeRabbit

  • New Feature: Enhanced account creation process in our system. Now, if you attempt to create an account with an address that already exists, the system will automatically update the existing account instead of generating an error. This change streamlines the account management process, making it more efficient and user-friendly.

@coderabbitai
Copy link

coderabbitai bot commented Oct 22, 2023

Walkthrough

The change modifies the CreateAccount function in the plugin struct to allow account overriding. If an account doesn't exist, it's created and set in the account keeper. If it does exist, it's overridden.

Changes

File Summary
.../x/evm/plugins/state/plugin.go The CreateAccount function in the plugin struct has been modified to allow account overriding. If an account doesn't exist, it's created and set in the account keeper. If it does exist, it's overridden.

🐇

In the land of code, where logic intertwines,

A rabbit hops, leaving traces of lines.

An account to create, or to override,

In the keeper of accounts, it shall reside.

With each hop and skip, the code takes shape,

A world of possibilities, the rabbit helps drape. 🎉


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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 help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

@itsdevbear itsdevbear changed the title fix(sdb): CreateAccount should check for existance before creating. fix(sdb): CreateAccount should check for existence before creating. Oct 22, 2023
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.

Review Status

Actionable comments generated: 1

Commits Files that changed from the base of the PR and between 8a2aff3 and bf383e7.
Files ignored due to filter (1)
  • e2e/testapp/docker/docker-compose.yml
Files selected for processing (1)
  • cosmos/x/evm/plugins/state/plugin.go (1 hunks)
Additional comments (Suppressed): 1
cosmos/x/evm/plugins/state/plugin.go (1)
  • 209-212: The new code checks if an account already exists before creating a new one, which is a good practice to prevent overwriting existing accounts. However, it's important to ensure that the GetAccount function is reliable and always returns the correct result. If there's a chance that GetAccount could return an incorrect result due to a race condition or other issue, it could lead to data inconsistency.

cosmos/x/evm/plugins/state/plugin.go Show resolved Hide resolved
@itsdevbear itsdevbear merged commit 216cf48 into main Oct 22, 2023
11 checks passed
@itsdevbear itsdevbear deleted the fix-panic branch October 22, 2023 21:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants