harmony-one / sdk

Javascript SDK of Harmony protocol.
MIT License
92 stars 43 forks source link

Superfluous pop in getRLPSigned #90

Open MaxMustermann2 opened 3 years ago

MaxMustermann2 commented 3 years ago

I see a set of three superfluous raw.pop(); statements which appear to be removing information from the raw (encoded but not signed) staking transaction here.

I believe these statements are callous because they are meant to be removing the pushes which only occur when chainId is not null, that is, when this condition: (this.chainId != null && this.chainId !== 0) is true.

To provide an example, if chainId were null, the pop statements would drop the last three elements of the array, that is, gasLimit, gasPrice and nonce. Is this intentional ?

In simple transactions (non-staking), this is taken care of by checking the array length but I do not see a similar check here.