-
Notifications
You must be signed in to change notification settings - Fork 268
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
LockingCap Refactor Integration #2672
Commits on Aug 20, 2024
-
Following with the Bridge refactors, it is now time to refactor and remove the locking cap business logic from the Bridge. Create its package lockingcap with a Support, StorageProvider, and Constants classes. Since it will have its classes should remove from the variable names, lockingCap, to avoid being redundant.
Configuration menu - View commit details
-
Copy full SHA for c6c88e1 - Browse repository at this point
Copy the full SHA c6c88e1View commit details -
Create LockingCapStorageIndexKey Enum
Create the package lockingcap with an enum to hold the storage index key for locking cap value. Create a new enum LockingCapStorageIndexKey to contain the index key for the locking cap value in storage, remove it from BridgeStorageIndexKey, remove the. _KEY suffix, and rename to LOCKING_CAP.
Configuration menu - View commit details
-
Copy full SHA for 1c9b2bf - Browse repository at this point
Copy the full SHA 1c9b2bfView commit details -
Locking Cap Storage Provider Interface
Create an interface LockingCapStorageProvider under co.rsk.peg.lockingcap package. Include the signature of the methods mentioned above. Rename saveLockingCap to simply save
Configuration menu - View commit details
-
Copy full SHA for 83c93be - Browse repository at this point
Copy the full SHA 83c93beView commit details -
Create a new interface LockingCapSupport under the co.rsk.peg.lockingcap package. Copy the signature and javadoc for the methods: getLockingCap and increaseLockingCap.
Configuration menu - View commit details
-
Copy full SHA for 06f541e - Browse repository at this point
Copy the full SHA 06f541eView commit details -
Following the Bridge refactors, we already migrated the LockingCapConstants to their classes to break the high coupling LockingCap had with the Bridge objects, however, it’s missing add coverage, so we need to create Unit Tests to get reliability that your new code doesn't break existing functionality when a change is made to the application. Create Unit Tests for all methods in LockingCapConstants Create Test Cases for all Networks such as MainNet, TestNet, and RegTest.
Configuration menu - View commit details
-
Copy full SHA for 07901e6 - Browse repository at this point
Copy the full SHA 07901e6View commit details -
Adding An Optional To Return Value getLockingCap() Method
Adding An Optional To Return Value getLockingCap() Method
Configuration menu - View commit details
-
Copy full SHA for de22bfd - Browse repository at this point
Copy the full SHA de22bfdView commit details -
Removing Arrays.stream From increaseAuthorizedKeys Variable
Removing Arrays.stream From increaseAuthorizedKeys Variable and replacing it with Collections.unmodifiableList(Stream.of()
Configuration menu - View commit details
-
Copy full SHA for 86bd490 - Browse repository at this point
Copy the full SHA 86bd490View commit details -
Create LockingCapConstants in BridgeConstants
Following with the Bridge refactors, it is now time to refactor and remove locking cap logic from BridgeSupport class. Create LockingCapConstants in BridgeConstants.
Configuration menu - View commit details
-
Copy full SHA for bfe4e85 - Browse repository at this point
Copy the full SHA bfe4e85View commit details -
Add LockingCapSupport To BridgeSupportBuilder
Following with the Bridge refactors, it is now time to refactor and remove locking cap logic from Bridge objects to LockingCap objects. This time we need to add Locking Cap logic to BridgeSupportBuilder class. Add WhitelistSupport to BridgeSupportBuilder business logic. Rebasing Changes With Integration Branch Rebasing Changes With Integration Branch
Configuration menu - View commit details
-
Copy full SHA for 686541a - Browse repository at this point
Copy the full SHA 686541aView commit details -
Configuration menu - View commit details
-
Copy full SHA for f78079d - Browse repository at this point
Copy the full SHA f78079dView commit details -
Fixing Issue When lockingCap Is Optional.empty()
- To avoid an NoSuchElementException trying to get the value from Optional.get() when is Optional.empty(), use orElse(null) method. Assigning a value to an instance variable - Assigning a value to an instance variable instead of return and after that assign. Improving readiness, readability and maintainability - Instead of enclosing in an IF a block of code, we ensure we have the RSKIP134 to execute the rest of the code.
Configuration menu - View commit details
-
Copy full SHA for 82f85ba - Browse repository at this point
Copy the full SHA 82f85baView commit details -
LockingCapSupport Implementation
After LockingCapSupport interface has been created, it is time to implement it. Create a new class LockingCapSupportImpl under co.rsk.peg.lockingcap package that implements the methods defined in LockingCapSupport interface. Take the implementation from BridgeSupport class, and move to this new class. Adapting implementation to stop using Optional and activation as an input at a Support level Getting back Optional since there's a case when we need to handle a null value Improving indentation Avoiding Null Pointer Exception - If it doesn't exist Locking Cap value, it must return false since RSKIP134 is not active. Assigning a value from an Optional to a new variable Rollback the changes on BridgeSupport
Configuration menu - View commit details
-
Copy full SHA for 7baf0ed - Browse repository at this point
Copy the full SHA 7baf0edView commit details -
Add LockingCapSupport Creation To BridgeSupportFactory
Update BridgeSupportFactory to create an instance of LockingCapSupport and pass it to BridgeSupport constructor. Fix code smells
Configuration menu - View commit details
-
Copy full SHA for 04afe10 - Browse repository at this point
Copy the full SHA 04afe10View commit details -
Adapt BridgeSupport Methods for LockingCap Refactor
After LockingCapSupport interface has been created, we’re going to use it on BridgeSupport. Adapt LockingCap methods in BridgeSupport.Use new interface created, LockingCapSupport, under co.rsk.peg.lockingcap package to create LockingCap behavior. Rebase Code Smell Removing Optional from getLockingCap() Method at a LockingCapSupport Level
Configuration menu - View commit details
-
Copy full SHA for 7b7001f - Browse repository at this point
Copy the full SHA 7b7001fView commit details -
Removing activations as an input in save() method at a LockingCapSupp…
…ort level Getting back Optional since there's a case when we need to handle a null value and adapting verifyLockDoesNotSurpassLockingCap to use getLockingCap() from LockingCapSupport Removing IF statement related to activation and adding a new validation to improve Readiness and Maintainability
Configuration menu - View commit details
-
Copy full SHA for 0c2e40b - Browse repository at this point
Copy the full SHA 0c2e40bView commit details -
Fix LockingCapTest after LockingCap refactor
Following the Bridge refactors, we already migrated the LockingCap processes to their classes to break the high coupling LockingCap had with the Bridge objects. After refactoring, showed up different issues in the tests and it is time to fix them. Fix LockingCapTest class, and improve if possible.
Configuration menu - View commit details
-
Copy full SHA for cf8fa26 - Browse repository at this point
Copy the full SHA cf8fa26View commit details -
Fix BridgeSupportAddSignatureTest after LockingCap refactor
Following the Bridge refactors, we already migrated the LockingCap processes to their classes to break the high coupling LockingCap had with the Bridge objects. After refactoring, showed up different issues in the tests and it is time to fix them. Fix BridgeSupportAddSignatureTest class.
Configuration menu - View commit details
-
Copy full SHA for f11ba1c - Browse repository at this point
Copy the full SHA f11ba1cView commit details -
Fix BridgeSupportIT after LockingCap refactor
Following the Bridge refactors, we already migrated the LockingCap processes to their classes to break the high coupling LockingCap had with the Bridge objects. After refactoring, showed up different issues in the tests and it is time to fix them. Fix BridgeSupportIT class.
Configuration menu - View commit details
-
Copy full SHA for d7d6600 - Browse repository at this point
Copy the full SHA d7d6600View commit details -
Fix BridgeSupportRegisterBtcTransactionTest after LockingCap refactor
Following the Bridge refactors, we already migrated the LockingCap processes to their classes to break the high coupling LockingCap had with the Bridge objects. After refactoring, showed up different issues in the tests and it is time to fix them. Fix BridgeSupportRegisterBtcTransactionTest class.
Configuration menu - View commit details
-
Copy full SHA for 47aa343 - Browse repository at this point
Copy the full SHA 47aa343View commit details -
Fix BridgeStorageProviderTest after LockingCap refactor
Following the Bridge refactors, we already migrated the LockingCap processes to their classes to break the high coupling LockingCap had with the Bridge objects. After refactoring, showed up different issues in the tests and it is time to fix them. Fix BridgeStorageProviderTest class. Get rid of LockingCap test methods.
Configuration menu - View commit details
-
Copy full SHA for 1b498d3 - Browse repository at this point
Copy the full SHA 1b498d3View commit details -
Fix BridgeSupportTest after LockingCap refactor
Following the Bridge refactors, we already migrated the LockingCap processes to their classes to break the high coupling LockingCap had with the Bridge objects. After refactoring, showed up different issues in the tests and it is time to fix them. Fix the BridgeSupportTest class.
Configuration menu - View commit details
-
Copy full SHA for fb27e23 - Browse repository at this point
Copy the full SHA fb27e23View commit details -
Fix PowpegMigrationTest after LockingCap refactor
Following the Bridge refactors, we already migrated the LockingCap processes to their classes to break the high coupling LockingCap had with the Bridge objects. After refactoring, showed up different issues in the tests and it is time to fix them. Fix the PowpegMigrationTest class. Get rid of setting the LockingCap since it is not mandatory in the test. From now on, the test will use the LockingCap default value, i.e., the LockingCapConstants.initialValue().
Configuration menu - View commit details
-
Copy full SHA for 26a9bc3 - Browse repository at this point
Copy the full SHA 26a9bc3View commit details -
Fix BridgeSupportTest after LockingCap refactor
Following the Bridge refactors, we already migrated the LockingCap processes to their classes to break the high coupling LockingCap had with the Bridge objects. After refactoring, showed up different issues in the tests and it is time to fix them. Fix the BridgeSupportTest class.
Configuration menu - View commit details
-
Copy full SHA for f90d21c - Browse repository at this point
Copy the full SHA f90d21cView commit details -
Add Coverage To LockingCapStorageProviderImpl
Following the Bridge refactors, we already migrated the LockingCap objects to their classes to break the high coupling LockingCap had with the Bridge objects, however, it’s missing add coverage, so we need to create Unit Tests to get reliability that your new code doesn't break existing functionality when a change is made to the application. - Create tests for LockingCapStorageProviderImpl. Keep Came Case In the Test Names Adding a blank line at the end of the file Getting Readiness To the Code Adding A New Test Case Improving Method Names Improving Variable Name Improving Method Names And Expected Variable Names Improving Method Names Improving Method Names Moving from place Papyrus200 tests Improving Comments Improving Assertions
Configuration menu - View commit details
-
Copy full SHA for f24a93c - Browse repository at this point
Copy the full SHA f24a93cView commit details -
Configuration menu - View commit details
-
Copy full SHA for b3e385a - Browse repository at this point
Copy the full SHA b3e385aView commit details -
Add Coverage To LockingCapSupportImpl
Following the Bridge refactors, we already migrated the LockingCapConstants to their classes to break the high coupling LockingCap had with the Bridge objects, however, it’s missing add coverage, so we need to create Unit Tests to get reliability that your new code doesn't break existing functionality when a change is made to the application. - Create Unit Tests for all methods in LockingCapSupportImpl. - Apply different tests for all scenarios. Activate the wasabi100 Fork to activate and deactivate RSKIPs necessaries in the Test Changing Method Name Changing Method Name Changing Method Names Keep Camel Case In Test Names Removing Blank Line Improving Name Method Improving Name Method Improving Name Method Improving Name Method Improving Name Method Adding A Blank Line Improving Variable Name Improving Method Names Use getLockingCap method from LockingCapSupport in Save Tests Improving Variable Name to maxLockingCapVoteValueAllowed
Configuration menu - View commit details
-
Copy full SHA for 1560a6d - Browse repository at this point
Copy the full SHA 1560a6dView commit details -
Add Coverage To LockingCap-Related Methods In BridgeSupport
Following the Bridge refactors, we already migrated the LockingCapConstants to their classes to break the high coupling LockingCap had with the Bridge objects, however, it’s missing add coverage, so we need to create Unit Tests to get reliability that your new code doesn't break existing functionality when a change is made to the application. - Create Unit Tests for all methods LockingCap-related in BridgeSupport. Setting private modifier to a constant variable Adding New Test Case - Adding new getLockingCap_whenLockingCapIsEmpty_ReturnNull test case. Keep Camel Case In Test Names Improving assertion to avoid compare instance but values
Configuration menu - View commit details
-
Copy full SHA for 3daa991 - Browse repository at this point
Copy the full SHA 3daa991View commit details -
Fix BridgeSupportFlyoverTest after LockingCap refactor
Fix registerBtcTransaction_after_RSKIP134_activation_sends_above_lockingcap test Rollback imports and moved `bridgeSupportBuilder.withLockingCapSupport` to the end before the build
Configuration menu - View commit details
-
Copy full SHA for 7d216bf - Browse repository at this point
Copy the full SHA 7d216bfView commit details -
Zero - Negative LockingCap Value Business Logic
Following the Bridge refactors, we already migrated the LockingCap processes to their classes to break the high coupling LockingCap had with the Bridge objects. Please move the business logic related to the zero-negative LockingCap value from Bridge.java to LockingCapSupportImpl.java. This way, decouple the process and get all LockingCap business logic, in the LockingCapSupport object. Adding log for Zero - Negative LockingCap Value Refactoring increaseLockingCap tests in BridgeTest
Configuration menu - View commit details
-
Copy full SHA for 5137774 - Browse repository at this point
Copy the full SHA 5137774View commit details -
Adding a new Customized LockingCapIllegalArgumentException
- Using in LockingCap objects LockingCapIllegalArgumentException. - In Bridge objects VMException. Created INCREASE_LOCKING_CAP_LOG_TAG constant to avoid String repetition Bank line to improve readability When No Arguments Test Case, replaced encodeSignature with encodeArguments method Created a message string to avoid repetition Avoiding String Repetition Removed Unused Import Improving Log Message Improving Log Message for maxLockingCapVoteValueAllowed Case Improving Exception Handling for increaseLockingCap in Bridge objects Use ActivationConfigsForTest.all() instead of papyrus200() - Use ActivationConfigsForTest.all() instead of papyrus200() since it's not needed a specific fork in the most of the test cases Improving Logger Messages Improving Logger Messages
Configuration menu - View commit details
-
Copy full SHA for ac81aa0 - Browse repository at this point
Copy the full SHA ac81aa0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 03f82e5 - Browse repository at this point
Copy the full SHA 03f82e5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8e74bfe - Browse repository at this point
Copy the full SHA 8e74bfeView commit details -
Improving LockingCapTest nested class in BridgeSupportTest
Get rid of getInstance in BridgeRegTestConstants Left the changes on LockingCapTest as it was early
Configuration menu - View commit details
-
Copy full SHA for 622ee18 - Browse repository at this point
Copy the full SHA 622ee18View commit details -
Configuration menu - View commit details
-
Copy full SHA for e53f0f6 - Browse repository at this point
Copy the full SHA e53f0f6View commit details -
Add Coverage in BridgeConstants
Add coverage for getFeePerKbConstants, getWhitelistConstants, and getFederationConstants in BridgeConstants. Use wildcard imports Get rid of assertEquals in new Unit Tests
Configuration menu - View commit details
-
Copy full SHA for 523432d - Browse repository at this point
Copy the full SHA 523432dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 947656b - Browse repository at this point
Copy the full SHA 947656bView commit details -
Following the Bridge refactors, we already migrated the LockingCapConstants to their classes to break the high coupling LockingCap had with the Bridge objects, however, it’s missing add coverage, so we need to create Unit Tests to get reliability that your new code doesn't break existing functionality when a change is made to the application. Create the Integration Test for the whole process related to LockingCap.
Configuration menu - View commit details
-
Copy full SHA for 96df961 - Browse repository at this point
Copy the full SHA 96df961View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1b9b7dc - Browse repository at this point
Copy the full SHA 1b9b7dcView commit details -
Configuration menu - View commit details
-
Copy full SHA for c04b77f - Browse repository at this point
Copy the full SHA c04b77fView commit details -
Remove unthrown exceptions from method signatures
Remove unused import
Configuration menu - View commit details
-
Copy full SHA for 35e5a8d - Browse repository at this point
Copy the full SHA 35e5a8dView commit details