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

refactor(store/v2): Store v2 supports create state at version 0 #20643

Closed
wants to merge 13 commits into from

Conversation

sontrinh16
Copy link
Member

@sontrinh16 sontrinh16 commented Jun 12, 2024

Description

ref: #20443


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • Tests
    • Adjusted versioning logic in various test cases to start from version 0 instead of 1. This impacts test scenarios for querying, committing, loading versions, and accessing state information.

@sontrinh16 sontrinh16 requested a review from a team as a code owner June 12, 2024 14:09
Copy link
Contributor

coderabbitai bot commented Jun 12, 2024

Walkthrough

Walkthrough

The changes across several test files aim to adjust the versioning logic from starting at 1 to starting at 0. This involves updating loop conditions, version parameters, and key values in various test cases and functions to accommodate the new versioning scheme. These modifications ensure consistency and correctness in handling version iterations and state migrations within the store package.

Changes

File(s) Change Summary
store/v2/commitment/store_test_suite.go Updated TestStore_Snapshotter to set latestVersion to 9 and adjust iteration ranges to start from 0.
store/v2/migration/manager_test.go Modified loop boundaries and key values in TestMigrateState to start from version 0 instead of 1.
store/v2/root/migrate_test.go Adjusted loop conditions in SetupTest and TestMigrateState to start from version 0 instead of 1.
store/v2/root/store.go Changed initial version value in New function and updated writeSC method to handle nil lastCommitInfo.
store/v2/root/store_test.go Updated version parameters in various test functions to start from 0 and adjusted version-related logic.

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.

@sontrinh16 sontrinh16 marked this pull request as draft June 12, 2024 14:11
@sontrinh16 sontrinh16 closed this Jun 12, 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.

Actionable comments posted: 8

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d3d6448 and ac22194.

Files selected for processing (6)
  • store/v2/commitment/store.go (7 hunks)
  • store/v2/commitment/store_test_suite.go (2 hunks)
  • store/v2/migration/manager_test.go (2 hunks)
  • store/v2/root/migrate_test.go (3 hunks)
  • store/v2/root/store.go (2 hunks)
  • store/v2/root/store_test.go (8 hunks)
Files not summarized due to errors (1)
  • store/v2/commitment/store.go: Error: Server error. Please try again later.
Files skipped from review due to trivial changes (1)
  • store/v2/migration/manager_test.go
Additional context used
Path-based instructions (5)
store/v2/commitment/store_test_suite.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

store/v2/root/migrate_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

store/v2/root/store_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

store/v2/root/store.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

store/v2/commitment/store.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

Additional comments not posted (8)
store/v2/commitment/store_test_suite.go (1)

Line range hint 36-104: Changes align with the PR's objective to support versioning starting from 0. Ensure snapshot functionality is correctly handling the new version range.

store/v2/root/migrate_test.go (2)

52-52: Changes correctly adjust the versioning to start from 0, aligning with the PR's objective. Verify that the migration setup handles the new version range correctly.


Line range hint 94-134: Changes correctly adjust the versioning to start from 0 in the migration tests, ensuring comprehensive coverage from the initial version. Verify that the migration process handles the new version range correctly.

store/v2/root/store_test.go (5)

Line range hint 92-104: Changes correctly adjust the versioning to start from 0 in the query tests, aligning with the PR's objective. Verify that the query functionality handles the new version range correctly.


150-153: Changes correctly adjust the versioning to start from 0 in the proof tests, ensuring comprehensive coverage from the initial version. Verify that the proof functionality handles the new version range correctly.


Line range hint 275-296: Changes correctly adjust the versioning to start from 0 in the state at tests, ensuring comprehensive coverage from the initial version. Verify that the state at functionality handles the new version range correctly.


120-130: Changes correctly adjust the versioning to start from 0 in the fallback tests, ensuring comprehensive coverage from the initial version. Verify that the fallback functionality handles the new version range correctly.

Verification successful

Let's directly run the Go test suite for the store/v2/root/store_test.go file to verify the fallback functionality.


Since the go command is not available, let's inspect the TestGetFallback function directly to ensure it correctly tests the fallback functionality.


Let's use rg to search for the TestGetFallback function and display its surrounding lines to inspect the implementation.


Let's search for all function definitions in the store/v2/root/store_test.go file to confirm the presence of TestGetFallback.


Let's search for the TestGetFallback function and display its surrounding lines to inspect the implementation.


Let's use rg to search for the TestGetFallback function with a simpler pattern and display its surrounding lines.


The TestGetFallback function is correctly implemented to test the fallback functionality starting from version 0. It ensures that the fallback mechanism works as expected by querying for a key and verifying the result.

  • The function creates a changeset and commits it to the state commitment.
  • It then queries for the key and checks if the fallback to the state commitment is successful.
  • It also tests querying a non-existent key to ensure proper handling.

This confirms that the fallback functionality is tested comprehensively from the initial version.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify fallback functionality handles the new version range correctly.

# Test: Run the fallback test and check for errors.
rg --type go $'TestGetFallback' store/v2/root/store_test.go --exec go test {}

Length of output: 487



Script:

#!/bin/bash
# Description: Run the Go test suite for the store_test.go file to verify fallback functionality.

# Locate the store_test.go file and run the tests.
go test ./store/v2/root/store_test.go

Length of output: 109



Script:

#!/bin/bash
# Description: Retrieve the implementation of the TestGetFallback function from the store_test.go file.

# Locate the TestGetFallback function in the store_test.go file.
ast-grep --lang go --pattern $'func TestGetFallback($_) {
  $$$
}' store/v2/root/store_test.go

Length of output: 95



Script:

#!/bin/bash
# Description: Search for the TestGetFallback function and display its surrounding lines.

# Locate the TestGetFallback function and display 20 lines before and after its occurrence.
rg 'func TestGetFallback' -A 20 -B 20 store/v2/root/store_test.go

Length of output: 67



Script:

#!/bin/bash
# Description: Search for all function definitions in the store_test.go file to confirm the presence of TestGetFallback.

# Locate all function definitions in the store_test.go file.
rg 'func ' store/v2/root/store_test.go

Length of output: 666



Script:

#!/bin/bash
# Description: Search for the TestGetFallback function and display its surrounding lines.

# Locate the TestGetFallback function and display 20 lines before and after its occurrence.
rg 'func (s \*RootStoreTestSuite) TestGetFallback' -A 20 -B 20 store/v2/root/store_test.go

Length of output: 92



Script:

#!/bin/bash
# Description: Search for the TestGetFallback function and display its surrounding lines.

# Locate the TestGetFallback function and display 20 lines before and after its occurrence.
rg 'TestGetFallback' -A 20 -B 20 store/v2/root/store_test.go

Length of output: 1404


Line range hint 166-180: Changes correctly adjust the versioning to start from 0 in the load version tests, ensuring comprehensive coverage from the initial version. Verify that the load version functionality handles the new version range correctly.

Verification successful

The TestLoadVersion function is present in the store/v2/root/store_test.go file and its implementation correctly handles the new version range by writing and committing changesets starting from version 0. It also ensures the latest version is correct and attempts to load a non-existent version to check for errors.

  • store/v2/root/store_test.go, lines 163-169: The function writes and commits changesets starting from version 0.
  • store/v2/root/store_test.go, lines 170-176: The function ensures the latest version is correct.
  • store/v2/root/store_test.go, lines 177-179: The function attempts to load a non-existent version and checks for errors.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify load version functionality handles the new version range correctly.

# Test: Run the load version test and check for errors.
rg --type go $'TestLoadVersion' store/v2/root/store_test.go --exec go test {}

Length of output: 487



Script:

#!/bin/bash
# Description: Run the Go tests in the store/v2/root/store_test.go file to verify the load version functionality.

# Locate the store_test.go file and run the tests.
fd store_test.go --exec go test {}

Length of output: 684



Script:

#!/bin/bash
# Description: Extract the implementation of the TestLoadVersion function from the store/v2/root/store_test.go file.

# Locate the store_test.go file and extract the TestLoadVersion function implementation.
fd store_test.go --exec ast-grep --lang go --pattern $'func TestLoadVersion($_) {
  $$$
}' {}

Length of output: 96



Script:

#!/bin/bash
# Description: Search for the TestLoadVersion function definition and extract the surrounding lines from the store/v2/root/store_test.go file.

# Locate the store_test.go file and search for the TestLoadVersion function definition.
fd store_test.go --exec rg --context 20 'func TestLoadVersion' {}

Length of output: 69



Script:

#!/bin/bash
# Description: Search for all function definitions in the store/v2/root/store_test.go file.

# Locate the store_test.go file and search for all function definitions.
fd store_test.go --exec rg --type go --pattern '^func ' {}

Length of output: 7890



Script:

#!/bin/bash
# Description: Search for all function definitions in the store/v2/root/store_test.go file.

# Locate the store_test.go file and search for all function definitions.
fd store_test.go --exec rg '^func ' {}

Length of output: 10446



Script:

#!/bin/bash
# Description: Extract the implementation of the TestLoadVersion function from the store/v2/root/store_test.go file.

# Locate the store_test.go file and extract the lines surrounding the TestLoadVersion function definition.
fd store_test.go --exec rg --context 20 'func (s *RootStoreTestSuite) TestLoadVersion' {}

Length of output: 93



Script:

#!/bin/bash
# Description: Extract the implementation of the TestLoadVersion function from the store/v2/root/store_test.go file.

# Locate the store_test.go file and extract the TestLoadVersion function implementation.
fd store_test.go --exec ast-grep --lang go --pattern $'func (s *RootStoreTestSuite) TestLoadVersion($_) {
  $$$
}' {}

Length of output: 120



Script:

#!/bin/bash
# Description: Search for the TestLoadVersion function definition and extract the surrounding lines from the store/v2/root/store_test.go file.

# Locate the store_test.go file and search for the TestLoadVersion function definition.
fd store_test.go --exec rg --context 20 'TestLoadVersion' {}

Length of output: 1378

Comment on lines +277 to +280
// since iavl still start version at 1
// TODO: revert this after iavl support create state at version 0
treeVer := version + 1

Copy link
Contributor

Choose a reason for hiding this comment

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

Update the version adjustment logic for proof generation.

- // since iavl still start version at 1
- // TODO: revert this after iavl support create state at version 0
- treeVer := version + 1
+ // Adjusted to start at version 0 as per new requirements
+ treeVer := version

Similar to the previous comment, this change is necessary to ensure consistency across all methods that handle versioning. Confirm that all dependent components are compatible with this versioning change.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// since iavl still start version at 1
// TODO: revert this after iavl support create state at version 0
treeVer := version + 1
// Adjusted to start at version 0 as per new requirements
treeVer := version

Comment on lines +149 to +152
// since iavl start at version 1 instead of 0
// TODO: revert this after iavl support create state at version 0
treeVer := targetVersion + 1

Copy link
Contributor

Choose a reason for hiding this comment

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

Adjust the versioning logic to start at 0.

- // since iavl start at version 1 instead of 0
- // TODO: revert this after iavl support create state at version 0
- treeVer := targetVersion + 1
+ // Adjusted to start at version 0 as per new requirements
+ treeVer := targetVersion

This change aligns with the PR's objective to support creating state at version 0. Ensure that the iavl library is updated to support this change before removing the TODO comment.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// since iavl start at version 1 instead of 0
// TODO: revert this after iavl support create state at version 0
treeVer := targetVersion + 1
// Adjusted to start at version 0 as per new requirements
treeVer := targetVersion

Comment on lines +307 to +310
// since iavl still start at version 1 instead of 0
// TODO: revert this after iavl support create state at version 0
treeVer := version + 1

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the versioning in the Get method.

- // since iavl still start at version 1 instead of 0
- // TODO: revert this after iavl support create state at version 0
- treeVer := version + 1
+ // Adjusted to start at version 0 as per new requirements
+ treeVer := version

Ensure that the Get method correctly interacts with the adjusted versioning system. This change is crucial for maintaining the integrity of data retrieval operations.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// since iavl still start at version 1 instead of 0
// TODO: revert this after iavl support create state at version 0
treeVer := version + 1
// Adjusted to start at version 0 as per new requirements
treeVer := version

Comment on lines +337 to +340
// since iavl start at version 1 instead of 0
// TODO: revert this after iavl support create state at version 0
treeVer := version + 1

Copy link
Contributor

Choose a reason for hiding this comment

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

Modify the pruning logic to accommodate the new versioning system.

- // since iavl start at version 1 instead of 0
- // TODO: revert this after iavl support create state at version 0
- treeVer := version + 1
+ // Adjusted to start at version 0 as per new requirements
+ treeVer := version

This adjustment ensures that the pruning process is consistent with the new versioning system. Verify that this change does not affect the integrity of the pruning process.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// since iavl start at version 1 instead of 0
// TODO: revert this after iavl support create state at version 0
treeVer := version + 1
// Adjusted to start at version 0 as per new requirements
treeVer := version

Comment on lines +462 to +465
// since iavl still start at version 1 instead of 0
// TODO: revert this after iavl support create state at version 0
treeVer := version + 1

Copy link
Contributor

Choose a reason for hiding this comment

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

Revise the restore logic to align with the new versioning system.

- // since iavl still start at version 1 instead of 0
- // TODO: revert this after iavl support create state at version 0
- treeVer := version + 1
+ // Adjusted to start at version 0 as per new requirements
+ treeVer := version

Ensure that the restore functionality is compatible with the new versioning system. This is critical for maintaining data consistency during state restoration.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// since iavl still start at version 1 instead of 0
// TODO: revert this after iavl support create state at version 0
treeVer := version + 1
// Adjusted to start at version 0 as per new requirements
treeVer := version

Comment on lines +373 to +375
// since iavl start at version 1 instead of 0
treeVer := version + 1

Copy link
Contributor

Choose a reason for hiding this comment

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

Update the snapshot versioning logic.

- // since iavl start at version 1 instead of 0
- treeVer := version + 1
+ // Adjusted to start at version 0 as per new requirements
+ treeVer := version

This change is necessary to ensure that snapshots are correctly handled under the new versioning system. It's important to test this thoroughly to avoid any issues with snapshot integrity.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// since iavl start at version 1 instead of 0
treeVer := version + 1
// Adjusted to start at version 0 as per new requirements
treeVer := version

@@ -72,7 +72,7 @@ func New(
) (store.RootStore, error) {
return &Store{
logger: logger.With("module", "root_store"),
initialVersion: 1,
initialVersion: 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

No tests were found that verify the initial version being set to 0. Please add a test to ensure the initial version is correctly set to 0 in the store initialization.

  • store/v2/root/store.go: initialVersion: 0
Analysis chain

Changes correctly set the initial version to 0 in the store's constructor, aligning with the PR's objective. Verify that the store initialization handles the new initial version correctly.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify store initialization handles the new initial version correctly.

# Test: Check the initial version after store creation.
rg --type go $'New' store/v2/root/store.go --exec go test {}

Length of output: 470



Script:

#!/bin/bash
# Description: Locate the New function and search for relevant tests.

# Step 1: Locate the New function in store/v2/root/store.go
echo "Locating the New function in store/v2/root/store.go"
ast-grep --lang go --pattern $'func New($_) $_' store/v2/root/store.go

# Step 2: Search for tests that verify the initial version of the store
echo "Searching for tests that verify the initial version of the store"
rg --type go 'initialVersion' --tests

Length of output: 793



Script:

#!/bin/bash
# Description: Locate the New function and search for relevant tests.

# Step 1: Locate the New function in store/v2/root/store.go
echo "Locating the New function in store/v2/root/store.go"
ast-grep --lang go --pattern $'func New($_) $_' store/v2/root/store.go

# Step 2: Search for test files that might contain tests for the initialVersion
echo "Searching for test files that might contain tests for the initialVersion"
rg --type go 'initialVersion'

Length of output: 2117



Script:

#!/bin/bash
# Description: Extract and review the relevant test from store/rootmulti/store_test.go

# Step 1: Extract the test that checks the initial version in store/rootmulti/store_test.go
echo "Extracting the test that checks the initial version in store/rootmulti/store_test.go"
rg --type go 'initialVersion' store/rootmulti/store_test.go

Length of output: 288



Script:

#!/bin/bash
# Description: Search for other tests that might check the initial version being set to 0.

# Step 1: Search for tests that check the initial version being set to 0
echo "Searching for tests that check the initial version being set to 0"
rg --type go 'initialVersion.*0' --tests

Length of output: 615



Script:

#!/bin/bash
# Description: Search for other tests that might check the initial version being set to 0.

# Step 1: Search for test files that might contain tests for the initial version
echo "Searching for test files that might contain tests for the initial version"
rg --type go 'initialVersion.*0'

Length of output: 296

Comment on lines +409 to +414
if s.lastCommitInfo == nil {
version = 0
} else {
version = previousHeight + 1
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The test cases in store/rootmulti/store_test.go do reference lastCommitInfo and verify its version after committing. However, there is no explicit test case that checks the behavior when lastCommitInfo is nil.

To ensure comprehensive coverage, a new test case should be added to verify the behavior of writeSC when lastCommitInfo is nil.

  • Add a test case to store/rootmulti/store_test.go to verify the behavior when lastCommitInfo is nil.
Analysis chain

Changes correctly handle the case where lastCommitInfo is nil by starting from version 0 in the writeSC method, ensuring that the store correctly handles the new initial version. Verify that the writeSC functionality handles the new version range correctly.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify writeSC functionality handles the new version range correctly.

# Test: Check the behavior of writeSC when `lastCommitInfo` is nil.
rg --type go $'writeSC' store/v2/root/store.go --exec go test {}

Length of output: 474



Script:

#!/bin/bash
# Step 1: Search for the `writeSC` function definition in the codebase.
ast-grep --lang go --pattern 'func writeSC($_, $_) $_' 

# Step 2: Identify test files that include tests for `writeSC`.
rg 'writeSC' --type go --glob '*_test.go'

Length of output: 98



Script:

#!/bin/bash
# Step 1: Search for the `writeSC` function definition with a broader pattern.
ast-grep --lang go --pattern 'func writeSC($$$) $_'

# Step 2: Search for any references to `lastCommitInfo` in test files.
rg 'lastCommitInfo' --type go --glob '*_test.go'

Length of output: 605



Script:

#!/bin/bash
# Extract relevant test cases from store/rootmulti/store_test.go that reference lastCommitInfo.
rg -A 10 'lastCommitInfo' store/rootmulti/store_test.go

Length of output: 1132

@tac0turtle tac0turtle deleted the son/create_state_at_version_0 branch December 18, 2024 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant