Skip to content

Commit

Permalink
fix: en_1 recommendations (#1746)
Browse files Browse the repository at this point in the history
(cherry picked from commit c4504bc)
  • Loading branch information
lucanicoladebiasi committed Jan 24, 2025
1 parent f7013bc commit 66e4cc7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
15 changes: 9 additions & 6 deletions packages/core/src/transaction/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,10 @@ class Transaction {
*/
public get isSigned(): boolean {
if (this.signature !== undefined) {
return Transaction.isSignatureValid(this.body, this.signature);
return Transaction.isSignatureLengthValid(
this.body,
this.signature
);
}
return false;
}
Expand Down Expand Up @@ -856,13 +859,13 @@ class Transaction {
}

/**
* Return Returns true if the signature is valid, otherwise false.
* Validates the length of a given signature against the expected length.
*
* @param {TransactionBody} body - The transaction body to be checked.
* @param {Uint8Array} signature - The signature to validate.
* @return {boolean} - Returns true if the signature is valid, otherwise false.
* @param {TransactionBody} body - The body of the transaction being validated.
* @param {Uint8Array} signature - The signature to verify the length of.
* @return {boolean} Returns true if the signature length matches the expected length, otherwise false.
*/
private static isSignatureValid(
private static isSignatureLengthValid(
body: TransactionBody,
signature: Uint8Array
): boolean {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/vcdm/hash/Keccak256.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { HexUInt } from '../HexUInt';
*/
class Keccak256 extends HexUInt {
/**
* Generates the [SHA-3](https://en.wikipedia.org/wiki/SHA-3) [KECCAK 256](https://keccak.team/keccak.html) hash of the given input.
* Generates the [KECCAK 256](https://eth-hash.readthedocs.io/en/stable/) hash of the given input.
*
* @param {bigint | number | string | Uint8Array | Hex} exp - The input value to hash.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,14 @@ class VeChainPrivateKeySigner extends VeChainAbstractSigner {
}

/**
* Sends %%transactionToSend%% to the Network. The ``signer.populateTransaction(transactionToSend)``
* is called first to ensure all necessary properties for the
* transaction to be valid have been populated first.
* Sends a transaction to the blockchain.
*
* @param transactionToSend - The transaction to send
* @returns The transaction response
* @throws {JSONRPCInvalidParams}
* @param {TransactionRequestInput} transactionToSend - The transaction object to be sent.
* This includes all the necessary details such as `to`, `value`, `data`, `gasLimit`, etc.
* @return {Promise<string>} A promise that resolves to the transaction hash as a string
* once the transaction is successfully sent.
* @throws {JSONRPCInvalidParams} Throws an error if the provider is not attached
* to the signer, indicating the signer's inability to send the transaction.
*/
async sendTransaction(
transactionToSend: TransactionRequestInput
Expand Down

1 comment on commit 66e4cc7

@github-actions
Copy link

Choose a reason for hiding this comment

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

Test Coverage

Summary

Lines Statements Branches Functions
Coverage: 99%
98.98% (4371/4416) 97.14% (1394/1435) 98.9% (905/915)
Title Tests Skipped Failures Errors Time
core 836 0 πŸ’€ 0 ❌ 0 πŸ”₯ 2m 22s ⏱️
network 731 0 πŸ’€ 0 ❌ 0 πŸ”₯ 4m 47s ⏱️
errors 40 0 πŸ’€ 0 ❌ 0 πŸ”₯ 18.064s ⏱️
logging 3 0 πŸ’€ 0 ❌ 0 πŸ”₯ 18.835s ⏱️
hardhat-plugin 19 0 πŸ’€ 0 ❌ 0 πŸ”₯ 1m 3s ⏱️
aws-kms-adapter 23 0 πŸ’€ 0 ❌ 0 πŸ”₯ 1m 24s ⏱️
ethers-adapter 5 0 πŸ’€ 0 ❌ 0 πŸ”₯ 1m 16s ⏱️
rpc-proxy 37 0 πŸ’€ 0 ❌ 0 πŸ”₯ 1m 4s ⏱️

Please sign in to comment.