Skip to content

Commit

Permalink
fix: unnecessary array copy when pack encoding (#6553)
Browse files Browse the repository at this point in the history
* fix: unnecessary array copy when pack encoding

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>

* fix: remove unreachable code

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>

* remove unsupported test fixture

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>

---------

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>
Co-authored-by: Muhammad Altabba <24407834+Muhammad-Altabba@users.noreply.github.com>
  • Loading branch information
mpetrunic and Muhammad-Altabba committed Nov 20, 2023
1 parent 2c60685 commit af91519
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/web3-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,7 @@ Documentation:
- `SocketProvider` now contains public function `getPendingRequestQueueSize`, `getSentRequestsQueueSize` and `clearQueues` (#6479)
- Added `safeDisconnect` as a `SocketProvider` method to disconnect only when request queue size and send request queue size is 0 (#6479)
- Add `isContractInitOptions` method (#6555)

### Fixed

- Fix unecessary array copy when pack encoding (#6553)
3 changes: 1 addition & 2 deletions packages/web3-utils/src/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,7 @@ export const processSolidityEncodePackedArgs = (arg: Sha3Input): string => {
* Encode packed arguments to a hexstring
*/
export const encodePacked = (...values: Sha3Input[]): string => {
const args = Array.prototype.slice.call(values);
const hexArgs = args.map(processSolidityEncodePackedArgs);
const hexArgs = values.map(processSolidityEncodePackedArgs);
return `0x${hexArgs.join('').toLowerCase()}`;
};

Expand Down

0 comments on commit af91519

Please sign in to comment.