Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/lib/TypedEncoder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ library TypedEncoder {
function encode(
Struct memory s
) internal pure returns (bytes memory) {
// Hash encoding returns keccak256(abi.encodePacked(all_fields)) as 32-byte hash
if (s.encodingType == EncodingType.Hash) {
return abi.encodePacked(_encodeHash(s));
}
// Packed encoding returns abi.encodePacked(all_fields) without hashing
if (s.encodingType == EncodingType.Packed) {
return _encodePacked(s);
Expand Down Expand Up @@ -227,8 +231,8 @@ library TypedEncoder {
}
// Encoding types implemented in later commits
if (
s.encodingType == EncodingType.Hash || s.encodingType == EncodingType.Create
|| s.encodingType == EncodingType.Create2 || s.encodingType == EncodingType.Create3
s.encodingType == EncodingType.Create || s.encodingType == EncodingType.Create2
|| s.encodingType == EncodingType.Create3
) {
revert EncodingTypeNotImplemented();
}
Expand Down
Loading
Loading