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

[wip] LinkedList cycle fix #941

Merged
merged 6 commits into from
Sep 17, 2019
Merged

[wip] LinkedList cycle fix #941

merged 6 commits into from
Sep 17, 2019

Conversation

mrsmkl
Copy link
Contributor

@mrsmkl mrsmkl commented Sep 12, 2019

Description

Just add the check to make sure that when inserting, the added key cannot be the same as the previous or next key.

Tested

Added some test files, didn't see any existing test for simple linked lists, and there were already checks for this in the other cases. I still want to add a test that would have actually made a cycle with the previous code.

Other changes

None

Related issues

Backwards compatibility

No effect.

@codecov
Copy link

codecov bot commented Sep 12, 2019

Codecov Report

Merging #941 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #941   +/-   ##
=======================================
  Coverage   66.93%   66.93%           
=======================================
  Files         252      252           
  Lines        7312     7312           
  Branches      482      418   -64     
=======================================
  Hits         4894     4894           
- Misses       2329     2331    +2     
+ Partials       89       87    -2
Flag Coverage Δ
#mobile 66.93% <ø> (ø) ⬆️
Impacted Files Coverage Δ
packages/mobile/src/utils/formatting.ts 87.5% <0%> (ø) ⬆️
packages/mobile/src/identity/reducer.ts 41.66% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4fcc603...44c880b. Read the comment docs.

Copy link
Contributor

@m-chrzan m-chrzan left a comment

Choose a reason for hiding this comment

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

Looks great! Just a few comments to address.

packages/protocol/test/common/linkedlist.ts Outdated Show resolved Hide resolved
packages/protocol/test/common/linkedlist.ts Outdated Show resolved Hide resolved
@@ -69,7 +69,7 @@ const DefaultConfig = {
}

const linkedLibraries = {
LinkedList: ['AddressLinkedList', 'SortedLinkedList'],
LinkedList: ['AddressLinkedList', 'SortedLinkedList', 'LinkedListTest'],
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be best if we didn't need to link test contracts in the production migrations. Can this linking be done in a before in the Truffle tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it will have any impact in a production migration (because the test contracts should not be deployed then). Anyway, you can check from this branch what linking inside the testsuite would look like: https://github.com/mrsmkl/celo-monorepo/compare/linked-list...mrsmkl:linking?expand=1
So one problem is that there is no link property for contracts in Truffle typings. But I can do the same thing for other test contracts too.

packages/protocol/test/common/linkedlist.ts Outdated Show resolved Hide resolved
@m-chrzan m-chrzan added the automerge Have PR merge automatically when checks pass label Sep 17, 2019
@ashishb ashishb merged commit 789d576 into celo-org:master Sep 17, 2019
aaronmgdr added a commit that referenced this pull request Sep 17, 2019
* master: (132 commits)
  [Wallet] Differentiate dollars and gold transactions (#1021)
  [wip] LinkedList cycle fix (#941)
  Fix slither issues (#572)
  [Wallet] Disable import wallet button when the backup phrase is not valid (#1012)
  Fix fixed fraction division underflow (#952)
  [CircleCI]Run protocol coverage once a day (#1018)
  Expose and test validator set precompiles (#874)
  [celotool] Fund Faucet accounts on network init (#990)
  Add Nexmo as a text provider for MX and US numbers (#1002)
  [CircleCI]Run protocol test with and without coverage (#991)
  Increase memory requests for Alfajores nodes (#966)
  [wallet]Select blockchain url based on testnet (#936)
  Pilot app config and ability to not show testnet banner (#1009)
  Add Linux onboarding steps and a TOC to SETUP.md (#1004)
  Add README-dev.md (#989)
  [Wallet] Exchange flow formatting fixes (#961)
  [celotool] Cleanup genesis block generation (#988)
  [celotool] Some ❤️. Clean up (#948)
  CeloCLI sorted list of Validator Groups should not include groups with zero votes (#907)
  [contractkit] Fix tests (#963)
  ...
aaronmgdr added a commit that referenced this pull request Sep 18, 2019
* master: (72 commits)
  Remove unused Reserve.burnToken function (#984)
  Persistent disks for transaction nodes (#1016)
  [Wallet] Differentiate dollars and gold transactions (#1021)
  [wip] LinkedList cycle fix (#941)
  Fix slither issues (#572)
  [Wallet] Disable import wallet button when the backup phrase is not valid (#1012)
  Fix fixed fraction division underflow (#952)
  [CircleCI]Run protocol coverage once a day (#1018)
  Expose and test validator set precompiles (#874)
  [celotool] Fund Faucet accounts on network init (#990)
  Add Nexmo as a text provider for MX and US numbers (#1002)
  [CircleCI]Run protocol test with and without coverage (#991)
  Increase memory requests for Alfajores nodes (#966)
  [wallet]Select blockchain url based on testnet (#936)
  Pilot app config and ability to not show testnet banner (#1009)
  Add Linux onboarding steps and a TOC to SETUP.md (#1004)
  Add README-dev.md (#989)
  [Wallet] Exchange flow formatting fixes (#961)
  [celotool] Cleanup genesis block generation (#988)
  [celotool] Some ❤️. Clean up (#948)
  ...

# Conflicts:
#	packages/web/src/header/Header.3.tsx
aaronmgdr added a commit that referenced this pull request Sep 18, 2019
* master: (38 commits)
  Remove unused Reserve.burnToken function (#984)
  Persistent disks for transaction nodes (#1016)
  [Wallet] Differentiate dollars and gold transactions (#1021)
  [wip] LinkedList cycle fix (#941)
  Fix slither issues (#572)
  [Wallet] Disable import wallet button when the backup phrase is not valid (#1012)
  Fix fixed fraction division underflow (#952)
  [CircleCI]Run protocol coverage once a day (#1018)
  Expose and test validator set precompiles (#874)
  [celotool] Fund Faucet accounts on network init (#990)
  Add Nexmo as a text provider for MX and US numbers (#1002)
  [CircleCI]Run protocol test with and without coverage (#991)
  Increase memory requests for Alfajores nodes (#966)
  [wallet]Select blockchain url based on testnet (#936)
  Pilot app config and ability to not show testnet banner (#1009)
  Add Linux onboarding steps and a TOC to SETUP.md (#1004)
  Add README-dev.md (#989)
  [Wallet] Exchange flow formatting fixes (#961)
  [celotool] Cleanup genesis block generation (#988)
  [celotool] Some ❤️. Clean up (#948)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Have PR merge automatically when checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Users SNBAT create a cycle in LinkedList
3 participants