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

chore: primitive contract tests #628

Merged
merged 2 commits into from
Sep 24, 2024
Merged

chore: primitive contract tests #628

merged 2 commits into from
Sep 24, 2024

Conversation

outerlook
Copy link
Contributor

@outerlook outerlook commented Sep 23, 2024

Description

  • add new tests to primitives about frozen dates and unauthorized inserts
  • changes test utils to accommodate requirements

Related Problem

How Has This Been Tested?

  • all tests pass

Summary by CodeRabbit

  • New Features

    • Introduced new test functions: testFrozenDataRetrieval and testUnauthorizedInserts for enhanced test coverage.
    • Added a utility function WithSigner to simplify the handling of signers in tests.
  • Improvements

    • Streamlined handling of stream identifiers and deployer addresses by introducing StreamLocator.
    • Updated various test functions to reflect changes in parameter usage, improving clarity and consistency.
  • Bug Fixes

    • Enhanced logic for Ethereum address handling within tests, reducing redundancy and improving readability.

@outerlook outerlook self-assigned this Sep 23, 2024
Copy link

coderabbitai bot commented Sep 23, 2024

Walkthrough

The pull request introduces significant modifications to various test files within the internal contracts module. Key changes include the simplification of function signatures, particularly the removal of unnecessary parameters in functions like getDBID and checkComposePermissions. Additionally, new test functions are added to enhance coverage, and data structures are updated to replace certain fields with more encapsulated alternatives. Overall, the changes aim to streamline the testing framework and improve the handling of stream identifiers and deployer addresses.

Changes

Files Change Summary
internal/contracts/tests/common_test.go, internal/contracts/tests/complex_composed_test.go, internal/contracts/tests/composed_test.go Function signatures updated to simplify calls by removing unnecessary parameters, specifically changing getDBID and checkComposePermissions to focus on essential arguments. Parameter ComposedStreamName replaced with StreamId.
internal/contracts/tests/index_change_test.go Refactored handling of Ethereum addresses to centralize address creation, improving clarity and reducing redundancy in test functions.
internal/contracts/tests/primitive_test.go Introduced new test functions testFrozenDataRetrieval and testUnauthorizedInserts, expanding test coverage for primitive data operations while updating existing test setups.
internal/contracts/tests/system_contract_test.go Updated deployPrimitiveStreamWithData function to remove the dataProvider parameter and utilize a new utility function for improved stream deployment handling.
internal/contracts/tests/utils/procedure/execute.go New function WithSigner added to modify the platform's deployer field, enhancing the management of signer information.
internal/contracts/tests/utils/setup/composed.go, internal/contracts/tests/utils/setup/primitive.go Updated structures to replace StreamId with StreamLocator, consolidating stream-related data and removing the Deployer field from various input structures for improved encapsulation.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Functions
    participant Platform as kwilTesting.Platform
    participant Stream as StreamLocator
    participant DB as Database

    Test->>Platform: Setup with new parameters
    Platform->>Stream: Create StreamLocator
    Stream->>DB: Generate DB ID
    DB-->>Stream: Return DB ID
    Stream-->>Platform: Provide Stream ID
    Platform-->>Test: Complete setup
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement tests for the primitive stream contract procedures (#[587])

Possibly related PRs

Suggested reviewers

  • MicBun

Poem

In the burrow where contracts play,
Functions dance and parameters sway.
With simpler calls and tests anew,
Our code hops high, like morning dew.
StreamLocators lead the way,
In our rabbit hole, we code and play! 🐇✨


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d9d0a16 and a2d9d79.

Files selected for processing (1)
  • internal/contracts/tests/primitive_test.go (5 hunks)
Files skipped from review as they are similar to previous changes (1)
  • internal/contracts/tests/primitive_test.go

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>, please review it.
    -- 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

The commit refactors the test setup by consolidating Ethereum address creation and signer assignment, improving code clarity and reducing redundancy. This change ensures consistent address handling across various test cases while leveraging a new helper function for setting up platforms with specific signers.
@outerlook outerlook marked this pull request as ready for review September 24, 2024 14:15
@outerlook outerlook requested a review from MicBun September 24, 2024 14:16
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: 6

Outside diff range and nitpick comments (9)
internal/contracts/tests/utils/procedure/execute.go (2)

103-108: Approve the addition of WithSigner function with suggestions for improvement

The new WithSigner function is a valuable addition that allows for easy creation of platform instances with different signers, which aligns well with the PR objective of testing unauthorized inserts. The function maintains immutability by not modifying the original platform, which is a good practice.

However, there are a couple of points to consider for improvement:

  1. The function performs a shallow copy of the platform struct. If kwilTesting.Platform contains any pointer fields, this could lead to unexpected behavior. Consider using a deep copy method if available, or document this limitation.

  2. The function doesn't validate the input signer byte slice. Consider adding a check for the expected length or format of the signer to prevent potential issues.

Here's a suggested improvement to address these points:

// WithSigner returns a new platform with the given signer, but doesn't mutate the original platform
func WithSigner(platform *kwilTesting.Platform, signer []byte) (*kwilTesting.Platform, error) {
    if len(signer) != ExpectedSignerLength { // Replace ExpectedSignerLength with the actual expected length
        return nil, fmt.Errorf("invalid signer length: expected %d, got %d", ExpectedSignerLength, len(signer))
    }

    newPlatform := platform.DeepCopy() // Assuming a DeepCopy method exists
    newPlatform.Deployer = signer
    return newPlatform, nil
}

If a DeepCopy method doesn't exist, consider adding a comment to document the shallow copy behavior.


Line range hint 1-108: Consider reorganizing the file structure for better readability

The addition of the WithSigner function at the end of the file is logical and doesn't disrupt existing code. However, to improve the overall structure and readability of the file, consider grouping related functions together.

Here's a suggested reorganization:

  1. Group all platform-related utility functions (including the new WithSigner) at the beginning of the file, after the imports.
  2. Follow with the procedure execution functions (GetRecord, GetIndex, GetIndexChange).
  3. Place helper functions like processResultRows at the end.

This organization will make it easier for developers to find related functionality and understand the file's structure at a glance.

internal/contracts/tests/composed_test.go (2)

45-47: LGTM! Consider adding a comment for clarity.

The changes look good and align with the PR objectives. The shift from ComposedStreamName to StreamId using composedStreamId.String() suggests an improvement in how stream identifiers are handled.

Consider adding a brief comment explaining the significance of using composedStreamId.String() instead of a plain string. This would enhance code readability and help future maintainers understand the rationale behind this change.

+   // Use composedStreamId.String() to ensure consistent stream identifier representation
    StreamId: composedStreamId.String(),

Line range hint 1-134: Overall, the changes improve consistency and align with PR objectives.

The modifications to both testComposedLastAvailable and testComposedNoPastData functions consistently replace ComposedStreamName with StreamId, using composedStreamId.String(). This change aligns well with the PR objectives of enhancing the testing framework for primitive contracts.

To further improve the codebase:

  1. Ensure that this change in stream identifier handling is consistently applied across all relevant parts of the codebase.
  2. Consider updating the documentation to reflect this change in how stream identifiers are managed.
  3. If not already done, it might be beneficial to add unit tests specifically for the composedStreamId object and its String() method to ensure its reliability.
internal/contracts/tests/index_change_test.go (3)

72-75: LGTM: Centralized Ethereum address handling

The changes improve the code by centralizing the creation and usage of the Ethereum address. This refactoring enhances code clarity and consistency.

Consider adding a comment explaining the purpose of creating the signer variable, especially if this pattern is repeated across multiple test functions. For example:

// Create signer from platform.Deployer for consistent Ethereum address handling
signer, err := util.NewEthereumAddressFromBytes(platform.Deployer)

Also applies to: 83-84


143-145: LGTM: Consistent Ethereum address handling in testYoYIndexChange

The changes in this function mirror those made in testIndexChange, ensuring consistent handling of Ethereum addresses across different test functions. This refactoring improves code clarity and maintainability.

For consistency with the suggestion for testIndexChange, consider adding a similar comment here:

// Create signer from platform.Deployer for consistent Ethereum address handling
signer, err := util.NewEthereumAddressFromBytes(platform.Deployer)

Also applies to: 159-163, 170-171


Line range hint 1-256: Summary: Improved Ethereum address handling across test functions

The changes in this file primarily focus on refactoring how Ethereum addresses are created and used within the test functions. This refactoring improves code consistency and clarity by centralizing the address creation logic. The modifications don't alter the actual test scenarios or assertions, suggesting that the core functionality remains unchanged.

Key improvements:

  1. Consistent use of StreamId in SetupPrimitiveFromMarkdown calls.
  2. Centralized creation of Ethereum addresses using signer variables.
  3. Uniform updating of Signer and Caller fields in TransactionData.

To further enhance the code:

  1. Consider extracting the common Ethereum address creation logic into a helper function to reduce duplication across test functions.
  2. Ensure all test functions, including testDivisionByZero, follow the new pattern for consistency unless there's a specific reason not to.
  3. Add comments explaining the purpose of the refactoring to improve code maintainability for future developers.
internal/contracts/tests/utils/setup/primitive.go (1)

213-217: Simplifying deployer derivation in insertPrimitiveData

The deployer is derived from input.primitiveStream.StreamLocator.DataProvider.Bytes(), then converted back to an EthereumAddress. Simplify by directly using DataProvider:

- deployer, err := util.NewEthereumAddressFromBytes(input.primitiveStream.StreamLocator.DataProvider.Bytes())
+ deployer := input.primitiveStream.StreamLocator.DataProvider

This change enhances code readability and eliminates unnecessary conversions.

internal/contracts/tests/primitive_test.go (1)

276-276: Clarify the comment for better readability.

The current comment could be clearer. Consider rephrasing it to improve understanding.

Apply this diff to enhance the comment:

-		// we set in 2022 not to mix up with the initial data set in 2021
+		// Use dates in 2022 to avoid mixing with the initial data set in 2021
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bf12535 and d9d0a16.

Files selected for processing (9)
  • internal/contracts/tests/common_test.go (17 hunks)
  • internal/contracts/tests/complex_composed_test.go (1 hunks)
  • internal/contracts/tests/composed_test.go (2 hunks)
  • internal/contracts/tests/index_change_test.go (4 hunks)
  • internal/contracts/tests/primitive_test.go (5 hunks)
  • internal/contracts/tests/system_contract_test.go (5 hunks)
  • internal/contracts/tests/utils/procedure/execute.go (2 hunks)
  • internal/contracts/tests/utils/setup/composed.go (10 hunks)
  • internal/contracts/tests/utils/setup/primitive.go (9 hunks)
Additional comments not posted (31)
internal/contracts/tests/composed_test.go (1)

94-96: LGTM! Verify the impact of these changes across the codebase.

The changes are consistent with those made in the testComposedLastAvailable function, which is good for maintaining a uniform approach across different test functions.

To ensure that these changes have been consistently applied across the codebase, please run the following script:

This script will help identify any inconsistencies in the usage of StreamId vs ComposedStreamName across the Go files in the project.

Verification successful

Changes Verified!

All instances of ComposedStreamName have been successfully removed, and StreamId is consistently used across the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistent use of StreamId instead of ComposedStreamName

# Test: Search for any remaining instances of ComposedStreamName
echo "Searching for remaining instances of ComposedStreamName:"
rg --type go 'ComposedStreamName'

# Test: Verify the consistent use of StreamId
echo "Verifying the use of StreamId:"
rg --type go 'StreamId:\s*composedStreamId\.String\(\)'

Length of output: 539

internal/contracts/tests/index_change_test.go (2)

52-55: LGTM: Addition of StreamId parameter

The addition of the StreamId parameter to the MarkdownPrimitiveSetupInput struct is consistent with the refactoring efforts to centralize the handling of Ethereum addresses. This change improves the clarity and consistency of the code.


Line range hint 228-256: Verify: Consistency in testDivisionByZero function

The testDivisionByZero function hasn't been updated to use the new Ethereum address handling pattern seen in other test functions. This might be an oversight or intentional.

Please verify if this function should be updated for consistency with the other test functions. If it should be updated, consider applying the following changes:

  1. Add the StreamId parameter to the SetupPrimitiveFromMarkdown call.
  2. Create a signer variable from platform.Deployer.
  3. Update the Signer and Caller fields in TransactionData to use the new signer variable.

If these changes are not necessary for this specific test, please add a comment explaining why to maintain code clarity.

internal/contracts/tests/complex_composed_test.go (2)

Line range hint 1-328: Missing tests for frozen dates and unauthorized inserts.

The PR objectives mention adding tests for frozen dates and unauthorized inserts. However, I don't see any new tests in this file addressing these scenarios. Could you please clarify:

  1. Are these tests implemented in other files not included in this review?
  2. If not, do we need to add these tests to this file or elsewhere?
  3. If these tests are not part of this PR, should we update the PR description to accurately reflect the changes?

To help locate any relevant tests that might exist elsewhere in the codebase, you can run the following script:

This will help us determine if these tests exist elsewhere or if they need to be added.


49-51: LGTM: Improved stream identification method.

The change from ComposedStreamName to StreamId is a good improvement. It likely provides a more robust and standardized way of identifying streams, which can help prevent naming conflicts and improve system scalability.

To ensure this change doesn't introduce inconsistencies, please run the following script to check for any remaining uses of ComposedStreamName in the codebase:

Also, could you clarify how this change relates to the PR objectives of adding tests for frozen dates and unauthorized inserts? These don't seem to be directly addressed in this file.

internal/contracts/tests/system_contract_test.go (6)

16-16: LGTM: New import added for procedure utilities.

The addition of the procedure package import is appropriate and likely related to the changes in the deployPrimitiveStreamWithData function.


124-124: Consistent change, but objectives clarification still needed.

This modification is consistent with the previous change to use procedure.WithSigner. However, as mentioned earlier, it's still not clear how these changes relate to the PR objectives of adding tests for frozen dates and unauthorized inserts. Could you provide more context on how these objectives are being addressed?


224-228: LGTM: Function signature simplified and made consistent with usage.

The changes to the deployPrimitiveStreamWithData function align well with the PR summary mentioning modifications to test utilities. The function signature has been simplified by removing the dataProvider parameter, and the StreamId is now generated within the function. These changes make the function more consistent with its usage in the test functions we've seen earlier.

A few observations:

  1. The removal of the dataProvider parameter suggests this information is now handled differently, possibly through the procedure.WithSigner utility.
  2. Generating the StreamId within the function using util.GenerateStreamId(streamName) centralizes this logic, which is a good practice.

These modifications appear to improve the overall structure and consistency of the test suite.


70-70: Approved: Updated function call, but clarification needed.

The modification to use procedure.WithSigner is consistent with the PR summary mentioning changes to test utilities. However, it's not immediately clear how this change relates to the PR objectives of adding tests for frozen dates and unauthorized inserts. Could you please clarify the connection?

To verify the implementation of tests for frozen dates and unauthorized inserts, let's search for related changes:

#!/bin/bash
# Search for new or modified test cases related to frozen dates and unauthorized inserts
rg -n -A 5 'func.*Test.*Frozen|func.*Test.*Unauthorized' internal/contracts/tests/

Line range hint 1-359: Summary: Refactoring improvements made, but clarification needed on PR objectives.

The changes in this file primarily involve refactoring the deployPrimitiveStreamWithData function and its usage across multiple test functions. These modifications align well with the PR summary mentioning changes to test utilities, improving the overall consistency and structure of the test suite.

However, the connection to the PR objectives of adding tests for frozen dates and unauthorized inserts is not immediately clear from the changes in this file. This suggests that either:

  1. These objectives are addressed in other files not shown in this review.
  2. The PR description might not accurately reflect all the changes made.

To ensure a comprehensive review:

  1. Could you clarify how the PR objectives (tests for frozen dates and unauthorized inserts) are addressed, either in this file or in others?
  2. If these objectives are met in other files, could you provide references to those files or changes?
  3. If the PR objectives have changed or evolved, consider updating the PR description to accurately reflect the current scope of changes.

To help clarify the scope of changes across the project, let's run a search for modified test files:

#!/bin/bash
# List all modified test files in the PR
git diff --name-only origin/main... | grep '_test\.go$'

This will help identify if there are other test files that might contain the changes related to frozen dates and unauthorized inserts.


153-153: Consistent changes across file, but overall explanation needed.

This change, along with the previous two, shows a consistent pattern of updating the deployPrimitiveStreamWithData function calls to use procedure.WithSigner. While these modifications appear to be part of a systematic refactoring of the test suite, it's not immediately clear how they address the PR objectives of adding tests for frozen dates and unauthorized inserts.

Could you provide an overall explanation of how these changes contribute to meeting the PR objectives? Are there additional changes or tests that directly address frozen dates and unauthorized inserts that might not be visible in this file?

To verify the implementation of the PR objectives, let's search for any new test functions or significant changes in the test files:

internal/contracts/tests/common_test.go (7)

209-209: Simplified getDBID function calls across multiple tests: Verify test suite functionality

The getDBID function calls have been simplified by removing the platform parameter across multiple test functions, consistent with the previous changes.

To ensure these changes don't affect the functionality of the test suite, please run the entire test suite and verify that all tests pass. You can use the following command:

#!/bin/bash
# Description: Run the entire test suite
go test -v ./internal/contracts/tests/

Also applies to: 245-245, 286-286, 321-321, 358-358, 385-385


431-431: Updated function calls: Verify test functionality and implementation

The getDBID function calls have been simplified by removing the platform parameter, consistent with previous changes. Additionally, the checkComposePermissions function call has been updated to remove the deployer parameter.

To ensure these changes don't affect the test's functionality and that the checkComposePermissions function is implemented correctly, please:

  1. Run the TestIsStreamAllowedToCompose test:
#!/bin/bash
# Description: Run the TestIsStreamAllowedToCompose test
go test -v -run TestIsStreamAllowedToCompose ./internal/contracts/tests/
  1. Verify the implementation of the checkComposePermissions function:
#!/bin/bash
# Description: Check the implementation of the checkComposePermissions function
rg --type go "func checkComposePermissions" internal/contracts/tests/common_test.go

Also applies to: 447-447, 449-449, 462-462


510-510: Updated helper functions: Review implementation thoroughly

The getDBID function has been simplified by removing the platform parameter, consistent with changes throughout the file. The checkComposePermissions function now derives the deployer from the platform, centralizing this logic.

These changes improve code consistency and centralize the deployer retrieval logic. However, please ensure that:

  1. The getDBID function still works correctly without the platform parameter.
  2. The checkComposePermissions function correctly retrieves and uses the deployer address.

To verify these changes, please review the implementation of both functions:

#!/bin/bash
# Description: Check the implementation of getDBID and checkComposePermissions functions
rg --type go "func (getDBID|checkComposePermissions)" internal/contracts/tests/common_test.go

Also applies to: 601-605


131-131: Simplified getDBID function call: Verify test functionality

The getDBID function call has been simplified by removing the platform parameter, consistent with the previous changes.

To ensure this change doesn't affect the test's functionality, please run the test suite and verify that the TestOnlyOwnerCanInsertMetadata test passes. You can use the following command:


63-63: Simplified getDBID function call: Verify implementation

The getDBID function call has been simplified by removing the platform parameter. This change aligns with the reported modifications in the summary.

To ensure this change doesn't affect the functionality, please verify the implementation of the getDBID function. Run the following command to check its definition:

Verification successful

Simplified getDBID function call verified

The getDBID function call has been successfully simplified by removing the platform parameter. This change aligns with the function's current implementation in internal/contracts/tests/common_test.go and does not affect other parts of the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the implementation of the getDBID function
rg --type go "func getDBID" internal/contracts/tests/common_test.go

Length of output: 146


Script:

#!/bin/bash
# Description: Search for the definition of the getDBID function across the entire codebase
rg --type go "func getDBID" .

Length of output: 122


7-8: New import added: Verify its usage

The new import "github.com/truflation/tsn-db/internal/contracts/tests/utils/procedure" has been added. This suggests the introduction of a utility package for procedures.

Please ensure that this new import is being used effectively in the test suite. Run the following command to verify its usage:


160-160: Simplified getDBID function call: Verify test functionality

The getDBID function call has been simplified by removing the platform parameter, consistent with the previous changes.

To ensure this change doesn't affect the test's functionality, please run the test suite and verify that the TestDisableMetadata test passes. You can use the following command:

internal/contracts/tests/utils/setup/primitive.go (13)

6-7: Importing types.StreamLocator

The import of github.com/truflation/tsn-sdk/core/types is necessary for the use of types.StreamLocator.


21-21: Updating PrimitiveStreamDefinition to use StreamLocator

Replacing the StreamId field with StreamLocator enhances encapsulation by combining StreamId and DataProvider into a single structure.


35-38: Modifying MarkdownPrimitiveSetupInput structure

The Deployer field has been replaced with StreamId, reflecting a shift in how deployment information is managed. This change aligns with the updated use of StreamLocator.


52-53: Setting primitive schema name using StreamLocator

primitiveSchema.Name is now assigned using setupInput.PrimitiveStreamWithData.StreamLocator.StreamId.String(), ensuring consistency with the updated data structures.


68-68: Generating dbid with consistent deployer

dbid is generated using setupInput.PrimitiveStreamWithData.StreamLocator.StreamId.String() and deployer.Bytes(). Ensure that deployer correctly corresponds to StreamLocator.DataProvider.Bytes() for consistency.


71-71: Passing Deployer to initializeContract

The deployer variable is passed to initializeContract. Confirm that it aligns with the DataProvider when initializing contracts involving third-party providers.


109-112: Constructing StreamLocator with StreamId and DataProvider

StreamLocator is correctly constructed using input.StreamId and deployer. Ensure that deployer accurately represents the DataProvider.


146-150: Updating InsertMarkdownDataInput structure

Fields have been updated to include StreamLocator instead of PrimitiveStreamName, allowing for more flexible data provider configurations.


160-160: Generating dbid using StreamLocator in InsertMarkdownPrimitiveData

dbid is generated using input.StreamLocator.StreamId.String() and input.StreamLocator.DataProvider.Bytes(), ensuring that the dataset identifier is correctly formed based on the new StreamLocator structure.


180-181: Setting Signer and Caller in TransactionData

Signer and Caller are set using signer.Bytes() and signer.Address(). Confirm that signer correctly represents the intended data provider.


206-209: Generating dbid in insertPrimitiveData

dbid is generated using input.primitiveStream.StreamLocator.StreamId.String() and input.primitiveStream.StreamLocator.DataProvider.Bytes(), ensuring consistency with the updated data structures.


224-225: Setting Signer and Caller in TransactionData

Using deployer.Bytes() and deployer.Address() for Signer and Caller ensures that transactions are executed with the correct identity.


60-61: Setting Signer and Caller in TransactionData

Signer and Caller are set using deployer.Bytes() and deployer.Address(), respectively. Verify that deployer correctly represents the intended signer, especially in the context of third-party data providers.

To confirm the deployer address, you can check for discrepancies:

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@outerlook outerlook merged commit d8ed159 into main Sep 24, 2024
6 checks passed
@outerlook outerlook deleted the chore/prim-tests branch September 24, 2024 18:44
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.

Problem: Primitive stream contract tests missing
2 participants