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

[Utility] Foundational bugs, tests, code cleanup and improvements (2/3) #550

Merged
merged 44 commits into from
Feb 28, 2023

Conversation

Olshansk
Copy link
Member

@Olshansk Olshansk commented Feb 27, 2023

Description

The second of three changes necessary to refactor and improve the utility module to enable implementation of future, more complex, interfaces.

While the list of changes in #503 was more bug & testing focused, this PR was more readability & documentation focused in preparation for M3.

Issue

Fixes #504

Type of change

Please mark the relevant option(s):

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Major breaking change
  • Documentation
  • Other

List of changes

  • Fixed bug where we were not removing txs from the mempool of replicas
  • Improved the readability of the Block lifecycle and Message validation
  • Replace unnecessary functions in such as Store(), getStoreAndHeight() and a few otherwise
  • Moved the Transaction proto to the shared module
  • Added documentation to TxResult result and removed DefaultTxResult and
  • Added extensive documentation to functions involved in the Block lifecycle
  • Removed unnecessary fields from the BlockHeader
  • Renamed GenericParam to ServiceURL
  • Consolidated StakeStatus in the shared package
  • Renamed governance parametesr related to rate limitting Applications
  • Renamed applyTx to hydrateTx and added documentation on its functionality

Testing

  • make develop_test
  • LocalNet w/ all of the steps outlined in the README

Required Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have tested my changes using the available tooling
  • I have updated the corresponding CHANGELOG

If Applicable Checklist

  • I have updated the corresponding README(s); local and/or global
  • I have added tests that prove my fix is effective or that my feature works
  • I have added, or updated, mermaid.js diagrams in the corresponding README(s)
  • I have added, or updated, documentation and mermaid.js diagrams in shared/docs/* if I updated shared/*README(s)

@Olshansk Olshansk added the utility Utility specific changes label Feb 27, 2023
Copy link
Contributor

@deblasis deblasis left a comment

Choose a reason for hiding this comment

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

Yo @Olshansk! I gave this a first pass. Solid work as usual.

Some bits and bolts and Qs. Depending on the priority of this vs what I am working on currently let me know if and how I can help you here. 🫡

@Olshansk Olshansk requested a review from deblasis February 28, 2023 01:00
Copy link
Member Author

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

@deblasis Thank you for the quick turnaround on the review.

PTAL at the changes I made along with the comments I left on the unresolved comments.

I think you have a good sense of some future follow-up work from the changes + the couple of issues I created out of it.

I want to prioritize getting this in given the size of the PR and because I'll be OOO later this week so there won't be much time to maintain & rebase it.

genericParam = DefaultMaxRelaysString
}
actor, pk := NewDefaultActor(int32(actorType), genericParam)
serviceUrl := getServiceURL(i + 1)
Copy link
Member Author

Choose a reason for hiding this comment

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

I changed everything I could to URL. The only thing thing that remains is the Url that's autogenerated by proto-c-gen which unfortunately can't be changed...

I added a comment to actor.proto:

  // proto-gen-c does not support `go_name` at the time of writing resulting
  // in the output go field being snakeCase: ServiceUrl (https://github.com/golang/protobuf/issues/555)

message Params {
reserved 4, 59; // Deprecated
Copy link
Member Author

Choose a reason for hiding this comment

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

One of the reasons I hesitated was to avoid doing it manually, but then I discovered: https://marketplace.visualstudio.com/items?itemName=ripwu.protobuf-helper

Ty for the push

Comment on lines 26 to 27
repeated string chains = 4; // Not applicable to `Validator` actors
string service_url = 5; // Not applicable to `Application` actors
Copy link
Member Author

Choose a reason for hiding this comment

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

// TODO(#555): Investigate ways of having actor specific params that are not part of the shared struct.
message Actor {

// Nonce cannot be empty to avoid transaction replays
if tx.Nonce == "" {
return ErrEmptyNonce()
return fmt.Errorf("nonce cannot be empty")
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@deblasis deblasis left a comment

Choose a reason for hiding this comment

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

🚢 🇮🇹

@Olshansk Olshansk merged commit 56ea777 into main Feb 28, 2023
@Olshansk
Copy link
Member Author

@deblasis Thank you again for the quick turnaround. I know this was a bit rushed but I did a local rerun of the unit tests and LocalNet (with docker-compose + sending a transaction) and verified that it works.

🚢 🇮🇹

I'm on season 2 of the White Lotus, so I guess I'll see you in Sicily.

@Olshansk Olshansk deleted the issues/504/utility_2_2 branch February 28, 2023 21:42
@deblasis
Copy link
Contributor

@deblasis Thank you again for the quick turnaround. I know this was a bit rushed but I did a local rerun of the unit tests and LocalNet (with docker-compose + sending a transaction) and verified that it works.

👍💯

🚢 🇮🇹

I'm on season 2 of the White Lotus, so I guess I'll see you in Sicily.

Never watched, no idea what's about but I hear it's pop culture already.

LOL. Funny. I might be going to Sicily for real in a few weeks...
MakeYouAnOfferGIF

bryanchriswhite added a commit that referenced this pull request Mar 1, 2023
* main:
  [Utility] Foundational bugs, tests, code cleanup and improvements (2/3) (#550)
  [CONSENSUS] Find issue with sending metadata request (#548)
  [Tooling] SLIP-0010 HD Child Key Generation (#510)
bryanchriswhite added a commit that referenced this pull request Mar 3, 2023
* main:
  [Libp2p] Add libp2p module directories and helpers (part 1) (#534)
  [P2P, Runtime] Update P2P & base config (part 2) (#535)
  [Utility] Foundational bugs, tests, code cleanup and improvements (2/3) (#550)
  [CONSENSUS] Find issue with sending metadata request (#548)
  [Tooling] SLIP-0010 HD Child Key Generation (#510)
@jessicadaugherty
Copy link
Contributor

Part 3/3 can be found here: #574

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
utility Utility specific changes
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Utility] Foundational bugs, tests, code cleanup and improvements (2/3)
3 participants