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

feat(test): Added test to call contract's read method #1324

Merged
merged 2 commits into from
Nov 23, 2023

Conversation

hunter-bera
Copy link
Contributor

@hunter-bera hunter-bera commented Nov 23, 2023

Ran make test-hive, all test cases passed. Closes berachain/pm#6

Summary by CodeRabbit

  • New Features

    • Enhanced smart contract interaction with additional output names for better clarity in read-only operations.
  • Tests

    • Implemented new tests to ensure reliable contract read-only method functionality.

Copy link

coderabbitai bot commented Nov 23, 2023

Walkthrough

The changes involve updating a Go source file related to Ethereum's Hive testing framework. Specifically, the predeployedContractABI variable has been modified to enhance the definition of a contract function, and a new test function deployContractTest has been added to verify the read-only operations of a contract.

Changes

File Path Change Summary
.../rpc/ethclient.hive Updated predeployedContractABI to include additional output names and added deployContractTest for testing contract read-only methods.

Assessment against linked issues

Objective Addressed Explanation
#6: Ensure ethereum/hive tests cover all cases The addition of a new test function suggests an effort to increase test coverage, addressing the objective of vetting ethereum/hive tests for completeness.

Poem

As autumn leaves fall, a test is born anew, 🍂
CodeRabbit hops along, ensuring all is true. 🐇
With each line of code, the Hive grows strong,
In the dance of bits, nothing shall go wrong.


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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

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

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: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e922486 and fc8cb0d.
Files ignored due to filter (6)
  • cosmos/go.mod
  • cosmos/go.sum
  • e2e/localnet/go.mod
  • e2e/localnet/go.sum
  • e2e/precompile/go.mod
  • e2e/precompile/go.sum
Files selected for processing (1)
  • e2e/hive/simulators/rpc/ethclient.hive (3 hunks)
Additional comments: 1
e2e/hive/simulators/rpc/ethclient.hive (1)
  • 424-457: The new test function deployContractTest has been added to test the contract read-only method. The code looks correct, but ensure that the predeployedContractABI variable reflects the actual ABI of the deployed contract, including the correct output names for the constFunc function.

e2e/hive/simulators/rpc/ethclient.hive Show resolved Hide resolved
e2e/hive/simulators/rpc/ethclient.hive Show resolved Hide resolved
e2e/hive/simulators/rpc/ethclient.hive Show resolved Hide resolved
@hunter-bera hunter-bera changed the title feat(test) Added test to call contract's read method feat(test): Added test to call contract's read method Nov 23, 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: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e922486 and 823aee4.
Files selected for processing (1)
  • e2e/hive/simulators/rpc/ethclient.hive (3 hunks)
Additional comments: 4
e2e/hive/simulators/rpc/ethclient.hive (4)
  • 3-3: The import for the bytes package is now present, resolving the previous issue.

  • 69-69: The predeployedContractABI variable has been updated to include output names for the constFunc function, addressing the previous comment.

  • 421-421: The error handling in deployContractTest is now consistent, using t.Fatalf for all error scenarios, which addresses the previous inconsistency issue.

  • 424-457: The new test deployContractTest correctly deploys a contract and tests a read-only method. The test checks the return values against the expected values, ensuring the contract's read method works as intended.

Copy link

codecov bot commented Nov 23, 2023

Codecov Report

Merging #1324 (823aee4) into main (e922486) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1324   +/-   ##
=======================================
  Coverage   48.47%   48.47%           
=======================================
  Files          84       84           
  Lines        4871     4871           
=======================================
  Hits         2361     2361           
  Misses       2336     2336           
  Partials      174      174           

@itsdevbear itsdevbear added merge me daddy Trigger Beradozer to bulldoze the PR backport/v0.0.2-alpha labels Nov 23, 2023
@mergify mergify bot merged commit 5eeed56 into main Nov 23, 2023
16 checks passed
@mergify mergify bot deleted the hunter/more-hive-test branch November 23, 2023 16:35
mergify bot pushed a commit that referenced this pull request Nov 23, 2023
Ran `make test-hive`, all test cases passed. Closes berachain/pm#6

## Summary by CodeRabbit

- **New Features**
  - Enhanced smart contract interaction with additional output names for better clarity in read-only operations.

- **Tests**
  - Implemented new tests to ensure reliable contract read-only method functionality.

(cherry picked from commit 5eeed56)
itsdevbear pushed a commit that referenced this pull request Nov 23, 2023
#1326)

This is an automatic backport of pull request #1324 done by
[Mergify](https://mergify.com).


---


<details>
<summary>Mergify commands and options</summary>

<br />

More conditions and actions can be found in the
[documentation](https://docs.mergify.com/).

You can also trigger Mergify actions by commenting on this pull request:

- `@Mergifyio refresh` will re-evaluate the rules
- `@Mergifyio rebase` will rebase this PR on its base branch
- `@Mergifyio update` will merge the base branch into this PR
- `@Mergifyio backport <destination>` will backport this PR on
`<destination>` branch

Additionally, on Mergify [dashboard](https://dashboard.mergify.com) you
can:

- look at your merge queues
- generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com
</details>

Co-authored-by: hunter-bera <133678627+hunter-bera@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.0.2-alpha merge me daddy Trigger Beradozer to bulldoze the PR testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants