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

add getters #12903

Merged
merged 4 commits into from
Apr 24, 2024
Merged

add getters #12903

merged 4 commits into from
Apr 24, 2024

Conversation

Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

Copy link
Contributor

I see you updated files related to contracts. Please run pnpm changeset in the contracts directory to add a changeset.

RyanRHall
RyanRHall previously approved these changes Apr 22, 2024
Copy link
Contributor

@RyanRHall RyanRHall left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Base automatically changed from enumberableSet to develop April 23, 2024 16:06
@shileiwill shileiwill dismissed RyanRHall’s stale review April 23, 2024 16:06

The base branch was changed.

@cl-sonarqube-production
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Comment on lines +603 to 616
function getTransmittersWithPayees() external view returns (TransmitterPayeeInfo[] memory) {
uint256 transmitterCount = s_transmittersList.length;
TransmitterPayeeInfo[] memory transmitters = new TransmitterPayeeInfo[](transmitterCount);

for (uint256 i = 0; i < transmitterCount; i++) {
address transmitterAddress = s_transmittersList[i];
address payeeAddress = s_transmitterPayees[transmitterAddress];

transmitters[i] = TransmitterPayeeInfo(transmitterAddress, payeeAddress);
}

return transmitters;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey sorry to do this after you've rebased.... but do you think we could change this into...

function getTransmitters() returns(address[]) {...}

function getPayees() returns(address[]) {...}

This is derived from our effort to avoid "monolithic getters" and instead prefer individual getters. Doing this tends to avoid migration issues better. Ex if a future version of automaition adds a struct to TransmitterPayeeInfo like maybe they add the field balance, then anyone using getTransmittersWithPayees() will break when they upgrade to the new registry. If we force all consumers to use these individual getters, it makes migrating easier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem, we work to improve whatever can be improved :). I get your point, and totally agree with the benefit of having smaller getters.

The only counter opinion for this particular usecase is that the transmitter and payee is 1:1, and the order really matters. So having them together have the benefit of grouping things in the right order. Not a strong opinion tho, they are sort/count manually with two getters. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm thinking more about the lifetime of this struct, TransmitterPayeeInfo - we could be careful not to change it and maybe just add a comment. But it does remind me of the Upkeep struct where we add things to it version after version and now we have that whole UpkeepInfoLegacyV2PlusBlahBlah lol

Copy link
Contributor

Choose a reason for hiding this comment

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

If we need to know more information about transmitters, I'd lean towards organizing that info into individual getters

Copy link
Contributor Author

@shileiwill shileiwill Apr 24, 2024

Choose a reason for hiding this comment

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

discussed offline, keeping it as is bc of the 1:1 mapping (order matters) of transmitter and payee.

@shileiwill shileiwill added this pull request to the merge queue Apr 24, 2024
Merged via the queue into develop with commit a293dfe Apr 24, 2024
109 checks passed
@shileiwill shileiwill deleted the getters branch April 24, 2024 22:54
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.

2 participants