You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function compares two strings by taking the keccak256 of their abi.encodePacked()ings.
We know the input type of keccak256 is bytes and string is easily converted to bytes by simple casting.
So this comparison can be made where each parameter is digested by keccak256(bytes(PARAM)).
This gives an equivalent correct check and saves gas drastically, as abi.encodePacked is really a superfluous operation here.
Granted, this function may be for validation during "callstatic" svg renderings, but even in that context gas savings may be ideal especially if the rendering of the artwork hits close to the available gas allowance of the queried provider.
The text was updated successfully, but these errors were encountered:
hot-chain-svg/contracts/Utils.sol
Line 77 in 6d19640
This function compares two strings by taking the
keccak256
of theirabi.encodePacked()
ings.We know the input type of
keccak256
isbytes
andstring
is easily converted tobytes
by simple casting.So this comparison can be made where each parameter is digested by
keccak256(bytes(PARAM))
.This gives an equivalent correct check and saves gas drastically, as
abi.encodePacked
is really a superfluous operation here.Granted, this function may be for validation during "callstatic" svg renderings, but even in that context gas savings may be ideal especially if the rendering of the artwork hits close to the available gas allowance of the queried provider.
The text was updated successfully, but these errors were encountered: