hashgraph / hedera-services

Crypto, token, consensus, file, and smart contract services for the Hedera public ledger
Apache License 2.0
281 stars 124 forks source link

Rename `SignedState` to `SignableState` #6216

Open cody-littley opened 1 year ago

cody-littley commented 1 year ago

πŸ†•πŸ₯ First Timers Only

This issue is reserved for people who have never contributed to Hedera or any open source project in general. We know that creating a pull request (PR) is a major barrier for new contributors. The goal of this issue and all other issues labeled by 'good first issue' is to help you make your first contribution to Hedera.

πŸ‘Ύ Description of the issue

There is a class SignedState.java. This class is the top level object of the state and has a field where signatures are added to it as they are collected. It collects signatures in this class level field:

    /**
     * the signatures collected so far (including from self)
     */
    private SigSet sigSet;

Once enough signatures are collected, the state is considered "signed". The name of this class is misleading because it implies that the state is always signed, but there is time before it collects enough signatures during which it is NOT signed. See in the SignedState.java constructor the sigSet is initialized with no signatures:

sigSet = new SigSet();

Signatures are added to the sigSet later, as they are collected, using this method:

    /**
     * Add a signature to the sigset. Does not validate the signature.
     *
     * @param nodeId    the ID of the node that provided the signature
     * @param signature the signature to add
     */
    public void addSignature(@NonNull final NodeId nodeId, @NonNull final Signature signature)

Steps to reproduce

Find the SignedState class. Observe the empty sigSet in the constructor.

Proposed Solution:

Refactor the SignedState.java class to SignableState.java. This new name is more accurate and clear, indicating that it is an object that can collect signatures but does not imply how many have been collected.

The refactor should include all test classes with the term SignedState in the name.

Leave the SignedStateInfo.java class alone. There is another ticket for removing this unused interface.

πŸ“‹ Step by step guide to do a contribution

If you have never contributed to an open source project at GitHub, the following step-by-step guide will introduce you to the workflow. More information and concrete samples for shell commands for each step can be found in our CONTRIBUTING.md file. A more detailed general documentation of the GitHub PR workflow can be found here.

πŸŽ‰ Contribute to Hacktoberfest

Solve this issue as part of the Hacktoberfest event and get a chance to receive cool goodies like a T-Shirt. 🎽

πŸ€” Additional Information

If you have any questions, just ask us directly in this issue by adding a comment. You can join our community chat at Discord. A general manual about open-source contributions can be found here.

Deepakgarg02 commented 17 hours ago

Hey I am Interested in making a contribution to this..