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][Persistence][Savepoints/Rollbacks] Refactor UtilityContext into UtilityUnitOfWork (Issue #563) #577

Merged
merged 194 commits into from
Mar 26, 2023

Conversation

deblasis
Copy link
Contributor

@deblasis deblasis commented Mar 12, 2023

Description

This PR creates the logical abstraction that would represent the "Unit Of Work" (inspired by Martin Fowler's work in his "Patterns of Enterprise Application Architecture")

Essentially what previously was known as UtilityContext becomes LeaderUtilityUnitOfWork or ReplicaUtilityUnitOfWork depending on the fact that the current node is the Leader or not (in Consensus).

It touches many files because it moves everything that is interacting with Persistence into the utility/unit_of_work folder.
This is to facilitate subsequent refactorings (see related PRs under #562) into more modular components.

This PR also sets the ground up for the completion of #508

Issue

Fixes #563

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

  • Refactored UtilityContext to be a polymorphic UtilityOfWork
  • Introduced LeaderUtilityUnitOfWork and ReplicaUtilityUnitOfWork that expose the methods that are going be to used depending on the "role" of the node in the consensus process.
  • Moved utilityContext related code under utility/unit_of_work and renamed all references accordingly

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)

deblasis added 30 commits March 9, 2023 21:11
deblasis added a commit that referenced this pull request Mar 21, 2023
…#596)

## Description

This PR improves DevX by outputting the result of a changelog validation
into the PR and requesting changes:


![image](https://user-images.githubusercontent.com/29378614/226392565-f20c77c2-19c7-42f7-8305-c11592f95f09.png)

Once the check is successful, the automatically added review comments
are dismissed

The commits of this PR are also included in #577 

## Issue

None because developed in < 4h

## Type of change

Please mark the relevant option(s):

- [x] New feature, functionality or library
- [ ] Bug fix
- [ ] Code health or cleanup
- [ ] Major breaking change
- [ ] Documentation
- [ ] Other <!-- add details here if it a different type of change -->

## List of changes

- Updated changelog-verify.yaml to automatically review / dismiss
changelog specific reviews

## Testing

- [ ] `make develop_test`
- [ ]
[LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md)
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 added, or updated, [`godoc` format
comments](https://go.dev/blog/godoc) on touched members (see:
[tip.golang.org/doc/comment](https://tip.golang.org/doc/comment))
- [ ] 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](https://mermaid-js.github.io) diagrams in the corresponding
README(s)
- [ ] I have added, or updated, documentation and
[mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*`
if I updated `shared/*`README(s)

---------

Signed-off-by: Alessandro De Blasis <alex@deblasis.net>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

The changelog validation failed with the following output:
"Missing changelog in module: consensus/

Missing changelog in module: persistence/

Missing changelog in module: runtime/

Missing changelog in module: shared/

Missing changelog in module: utility/

Changelog verification failed. See error messages for more detail.
"

Please update the relevant CHANGELOG.md files and ensure they follow the correct format.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

The changelog validation failed with the following output:
Missing changelog in module: consensus/

Missing changelog in module: persistence/

Missing changelog in module: runtime/

Missing changelog in module: shared/

Missing changelog in module: utility/

Changelog verification failed. See error messages for more detail.

Please update the relevant CHANGELOG.md files and ensure they follow the correct format.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

The changelog validation failed with the following output:
Missing changelog in module: shared/

Changelog verification failed. See error messages for more detail.

Please update the relevant CHANGELOG.md files and ensure they follow the correct format.

@github-actions github-actions bot dismissed stale reviews from themself March 21, 2023 01:01

The check succeeded, dismissing the review comment.

@deblasis
Copy link
Contributor Author

deblasis commented Mar 21, 2023

Live test for #596

changelog_automation_ok.mp4

Validation transitions from ❌to✅ and the request changes is dismissed successfully

@Olshansk
Copy link
Member

Live test for #596

Validation transitions from ❌to✅ and the request changes is dismissed successfully

giphy (1)

dylanlott pushed a commit that referenced this pull request Mar 24, 2023
…#596)

## Description

This PR improves DevX by outputting the result of a changelog validation
into the PR and requesting changes:


![image](https://user-images.githubusercontent.com/29378614/226392565-f20c77c2-19c7-42f7-8305-c11592f95f09.png)

Once the check is successful, the automatically added review comments
are dismissed

The commits of this PR are also included in #577 

## Issue

None because developed in < 4h

## Type of change

Please mark the relevant option(s):

- [x] New feature, functionality or library
- [ ] Bug fix
- [ ] Code health or cleanup
- [ ] Major breaking change
- [ ] Documentation
- [ ] Other <!-- add details here if it a different type of change -->

## List of changes

- Updated changelog-verify.yaml to automatically review / dismiss
changelog specific reviews

## Testing

- [ ] `make develop_test`
- [ ]
[LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md)
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 added, or updated, [`godoc` format
comments](https://go.dev/blog/godoc) on touched members (see:
[tip.golang.org/doc/comment](https://tip.golang.org/doc/comment))
- [ ] 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](https://mermaid-js.github.io) diagrams in the corresponding
README(s)
- [ ] I have added, or updated, documentation and
[mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*`
if I updated `shared/*`README(s)

---------

Signed-off-by: Alessandro De Blasis <alex@deblasis.net>
Copy link
Member

@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.

Really big fan of this change. W/e approach we end up going with, this will make it easier (e.g. storing the key-value pairs we need to roll back to/from in my design approach).

In either case, let's :shipit: and see how next week goes. I'll try to think of 40 reasons not to go with the JSON approach ;)


height int64

persistenceReadContext modules.PersistenceReadContext
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add a comment explaining why we have both with a potential example use case.

dylanlott pushed a commit to dylanlott/pocket that referenced this pull request Mar 24, 2023
…pokt-network#596)

## Description

This PR improves DevX by outputting the result of a changelog validation
into the PR and requesting changes:


![image](https://user-images.githubusercontent.com/29378614/226392565-f20c77c2-19c7-42f7-8305-c11592f95f09.png)

Once the check is successful, the automatically added review comments
are dismissed

The commits of this PR are also included in pokt-network#577 

## Issue

None because developed in < 4h

## Type of change

Please mark the relevant option(s):

- [x] New feature, functionality or library
- [ ] Bug fix
- [ ] Code health or cleanup
- [ ] Major breaking change
- [ ] Documentation
- [ ] Other <!-- add details here if it a different type of change -->

## List of changes

- Updated changelog-verify.yaml to automatically review / dismiss
changelog specific reviews

## Testing

- [ ] `make develop_test`
- [ ]
[LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md)
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 added, or updated, [`godoc` format
comments](https://go.dev/blog/godoc) on touched members (see:
[tip.golang.org/doc/comment](https://tip.golang.org/doc/comment))
- [ ] 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](https://mermaid-js.github.io) diagrams in the corresponding
README(s)
- [ ] I have added, or updated, documentation and
[mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*`
if I updated `shared/*`README(s)

---------

Signed-off-by: Alessandro De Blasis <alex@deblasis.net>
…or-utilitycontext-to-utilityunitofwork

Signed-off-by: Alessandro De Blasis <alex@deblasis.net>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

The changelog validation failed with the following output:
Latest date in persistence/docs/CHANGELOG.md is incorrect.
Latest: 2023-03-21, Current: 2023-03-26

Latest date in runtime/docs/CHANGELOG.md is incorrect.
Latest: 2023-03-21, Current: 2023-03-26

Latest date in utility/doc/CHANGELOG.md is incorrect.
Latest: 2023-03-21, Current: 2023-03-26

Changelog verification failed. See error messages for more detail.

Please update the relevant CHANGELOG.md files and ensure they follow the correct format.

@github-actions github-actions bot dismissed their stale review March 26, 2023 20:37

The check succeeded, dismissing the review comment.

@deblasis deblasis merged commit 19bf4d3 into main Mar 26, 2023
bryanchriswhite added a commit that referenced this pull request Mar 28, 2023
…p-modules

* pokt/main:
  [Utility][Persistence][Savepoints/Rollbacks] Refactor UtilityContext into UtilityUnitOfWork (Issue #563) (#577)
  [Consensus] Add Quorum Certificate to the block (#593)
  docs(wiki): ValueError: Duplicate wiki path: devlog/template (#620)
  Remove unused import
  [Infra][P2P] Bug: "address not found in peerstore" error in localnet_debug_client when scaling up Localnet - Issue #604 (#611)
  [CLI][Localnet][Bug] - [localnet_client_debug] Error 137 - Issue #607 (#608)
  [Documentation] Fix links to RPC module docs in README (#603)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
persistence Persistence specific changes utility Utility specific changes
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Utility][Persistence][Savepoints/Rollbacks] Refactor UtilityContext into UtilityUnitOfWork
2 participants