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: forge fmt #272

Merged
merged 2 commits into from
Jan 3, 2024
Merged

chore: forge fmt #272

merged 2 commits into from
Jan 3, 2024

Conversation

rach-id
Copy link
Member

@rach-id rach-id commented Dec 21, 2023

Overview

CI is failing in PRs because foundry added new rules to their formatter. This PR fixes those

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

Summary by CodeRabbit

  • Style
    • Improved code readability by adjusting spacing in array size calculations.
  • Refactor
    • Made minor formatting enhancements across several files for better consistency.

@rach-id rach-id added the chore label Dec 21, 2023
@rach-id rach-id self-assigned this Dec 21, 2023
Copy link

coderabbitai bot commented Dec 21, 2023

Walkthrough

The changes across the files are primarily cosmetic, involving minor adjustments to formatting such as adding spaces around operators for better readability. There are no alterations that affect the logic or functionality of the code. The updates seem to be a part of a code clean-up process to adhere to a coding style guideline.

Changes

File Path Change Summary
.../tree/binary/BinaryMerkleTree.sol
.../verifier/DAVerifier.sol
Added spaces around subtraction operators in array size calculations for clarity.
.../tree/namespace/test/NamespaceMerkleMultiproof.t.sol
.../tree/namespace/test/NamespaceMerkleTree.t.sol
Minor formatting changes; no impact on functionality.
.../ERC1967Proxy.sol/wrapper.go Reorganized ABI declaration, potential impact on contract interface interpretation.

🐰✨📜✨🌳

In the code forest, quite serene,
A rabbit hopped to spaces unseen,
Between the lines, it leapt with grace,
Leaving a trail of clarity in place.
🌳✨📜✨🐰

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 X ?


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>.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions. Examples:
    • @coderabbitai render interesting statistics about this repository as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai generate unit tests for the src/utils.ts file.

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

@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 3e631e0 and 508e184.
Files selected for processing (5)
  • src/lib/tree/binary/BinaryMerkleTree.sol (1 hunks)
  • src/lib/tree/binary/test/BinaryMerkleTree.t.sol (1 hunks)
  • src/lib/tree/namespace/test/NamespaceMerkleMultiproof.t.sol (1 hunks)
  • src/lib/tree/namespace/test/NamespaceMerkleTree.t.sol (1 hunks)
  • src/lib/verifier/DAVerifier.sol (1 hunks)
Files skipped from review due to trivial changes (4)
  • src/lib/tree/binary/BinaryMerkleTree.sol
  • src/lib/tree/binary/test/BinaryMerkleTree.t.sol
  • src/lib/tree/namespace/test/NamespaceMerkleMultiproof.t.sol
  • src/lib/tree/namespace/test/NamespaceMerkleTree.t.sol
Additional comments: 1
src/lib/verifier/DAVerifier.sol (1)
  • 254-254: The formatting change to add spaces around the subtraction operator in the array size calculation improves readability and adheres to the new formatting rules.

src/lib/verifier/DAVerifier.sol Show resolved Hide resolved
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 508e184 and f10f3ac.
Files selected for processing (2)
  • wrappers/Blobstream.sol/wrapper.go (1 hunks)
  • wrappers/ERC1967Proxy.sol/wrapper.go (1 hunks)
Files not summarized due to errors (1)
  • wrappers/Blobstream.sol/wrapper.go: Error: Message exceeds token limit
Additional comments: 9
wrappers/ERC1967Proxy.sol/wrapper.go (1)
  • 34-34: The ABI string in WrappersMetaData has been reformatted. Verify that the new ABI string correctly represents the contract's interface and that the reordering of elements does not affect any dependent code or tools that may rely on the order of elements in the ABI.
Verification successful

The previous script contained an error as it did not use the actual ABI string for validation. Let's correct this and run a new script to verify the JSON structure of the ABI string.


The script failed due to a parse error in the JSON string, likely caused by the unnecessary escape characters. I will correct the script and run it again to validate the JSON structure of the ABI string.


The absence of output from the jq command, in this case, indicates that the JSON string is valid, as jq empty would produce an error message if the input were not valid JSON. Therefore, the ABI string in the WrappersMetaData is correctly formatted as valid JSON.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the ABI string is valid JSON
echo 'WrappersMetaData ABI' | jq empty

Length of output: 98



Script:

#!/bin/bash
# Verify that the ABI string is valid JSON
echo '[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_logic\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"payable\"},{\"type\":\"fallback\",\"stateMutability\":\"payable\"},{\"type\":\"receive\",\"stateMutability\":\"payable\"},{\"type\":\"event\",\"name\":\"AdminChanged\",\"inputs\":[{\"name\":\"previousAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"newAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BeaconUpgraded\",\"inputs\":[{\"name\":\"beacon\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Upgraded\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false}]' | jq empty

Length of output: 1013



Script:

#!/bin/bash
# Verify that the ABI string is valid JSON
echo '[{"type":"constructor","inputs":[{"name":"_logic","type":"address","internalType":"address"},{"name":"_data","type":"bytes","internalType":"bytes"}],"stateMutability":"payable"},{"type":"fallback","stateMutability":"payable"},{"type":"receive","stateMutability":"payable"},{"type":"event","name":"AdminChanged","inputs":[{"name":"previousAdmin","type":"address","indexed":false,"internalType":"address"},{"name":"newAdmin","type":"address","indexed":false,"internalType":"address"}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"name":"beacon","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"name":"implementation","type":"address","indexed":true,"internalType":"address"}],"anonymous":false}]' | jq empty

Length of output: 814

wrappers/Blobstream.sol/wrapper.go (8)
  • 60-61: The ABI and binary strings for the smart contract are embedded directly into the Go source code. This is a common practice for generated bindings, but it's important to ensure that the ABI and binary are up-to-date with the latest contract deployed on the blockchain. If the contract has been updated, these strings should be regenerated to match the current contract.

  • 64-64: The WrappersABI and WrappersBin variables are marked as deprecated and now reference the WrappersMetaData struct. Ensure that this deprecation is intentional and that any developers using these variables are informed of the change to avoid potential issues.

  • 64-64: The DeployWrappers function correctly handles errors and returns them to the caller. It also checks for a nil ABI which is good practice to avoid nil pointer dereferences. This function appears to be implemented correctly.

  • 64-64: The Wrappers struct and its embedded types (WrappersCaller, WrappersTransactor, WrappersFilterer) follow Go's naming conventions and struct embedding practices for representing different contract interaction patterns. This is a standard approach for Go Ethereum contract bindings.

  • 64-64: The bindWrappers function correctly handles errors by returning them to the caller. It also ensures that the ABI is not nil before creating a new bound contract, which is a good practice to prevent runtime errors.

  • 64-64: The Call, Transfer, and Transact methods on WrappersRaw and WrappersCallerRaw/WrappersTransactorRaw are standard methods generated for raw contract interactions in Go Ethereum bindings. They correctly propagate errors and follow the established patterns for such operations.

  • 64-64: The generated code for contract method bindings such as UPGRADEINTERFACEVERSION, Owner, ProxiableUUID, etc., follows the Go Ethereum binding standards. Each method correctly handles the conversion of the output to the expected Go type and returns any errors encountered during the call.

  • 64-64: The generated code for contract event bindings such as FilterDataRootTupleRootEvent, WatchDataRootTupleRootEvent, etc., adheres to the Go Ethereum binding standards. The methods use the correct event signatures and provide the necessary functionality to filter and watch for events emitted by the contract.

@rach-id rach-id merged commit f0ae0f4 into celestiaorg:master Jan 3, 2024
11 checks passed
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.

2 participants