Skip to content

Refactor code for readability [redux] #181

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

Open
wants to merge 3 commits into
base: celo-integration-rebase-13.1
Choose a base branch
from

Conversation

QuentinI
Copy link
Collaborator

@QuentinI QuentinI commented Jun 20, 2025

This is a re-base of #109

This PR:

Refactors the optimism_espresso_test_helpers.go file to help readability and maintainability

The code within the optimism_espresso_test_helpers.go file works without issue, but it can be difficult to follow due to being over a hundred lines and several indentation levels deep. This code has been split up into smaller functions that are more focused and feature additional comments to motivate and describe their actions.

This PR does not:

Modify the existing behavior, it should just move the logic and behavior into different functions to help readability and maintainability.

@QuentinI QuentinI marked this pull request as ready for review June 20, 2025 17:36
@QuentinI QuentinI changed the title Refactor code for readability redux Refactor code for readability [redux] Jun 20, 2025
Copy link
Collaborator

@philippecamacho philippecamacho left a comment

Choose a reason for hiding this comment

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

LGTM

Ayiga added 2 commits June 26, 2025 12:05
The code in the `optimism_test_helpers.go` works but a lot of it is
deeply nested and long which hurts readability.

This change refactors the code into smaller functions with reduced
indentation level, and more annotated comments to help
readability, maintainability, and clarity.
When attempting to run the refactor on a linux machine, some errors are
encountered.  When Asking @philippecamacho about the errors
encountered he provided the error:
 `"unable to determine the host for the espresso-dev-node sequencer api"`

 This error occurs when the remapping has failed.  Comparing the
 refactor changes against the original implementation indicated
 a slight change in the logic.  The change is meant to ensure that
 the port is populated correctly on the container port map.  However
 it only checks the remapped values which are always populated with
 the given value.  This makes this condition a tautological expression
 which will never remap when it should.

 This fix changes the inspected value, and also adds a fail-safe to
 always process the re-assignment when the `network` is set to
 `"host"`.
@Ayiga Ayiga force-pushed the ag/ts/ref/cleanup-code-helpers-for-espresso-devnet branch from b1b8d05 to f125272 Compare June 26, 2025 18:08
@Ayiga Ayiga force-pushed the ag/ts/ref/cleanup-code-helpers-for-espresso-devnet branch from 0ab15cd to d522613 Compare June 27, 2025 13:56
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.

3 participants