Skip to content

Commit e233d1b

Browse files
committed
up
1 parent 2eb132b commit e233d1b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/core/solidity/src/erc7579.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function overrideValidation(c: ContractBuilder, opts: ERC7579Options): void {
204204
`bytes32 public constant EXECUTION_TYPEHASH = "Execute(address account,bytes32 salt,${!delayed ? 'uint256 nonce,' : ''}bytes32 mode,bytes executionCalldata)"`,
205205
);
206206
const body = [
207-
`uint16 executionCalldataLength = uint16(uint256(bytes32(${fn.args[3]!.name}[0:2]))); // First 2 bytes are the length`,
207+
`uint16 executionCalldataLength = uint16(bytes2(${fn.args[3]!.name}[0:2])); // First 2 bytes are the length`,
208208
`bytes calldata executionCalldata = ${fn.args[3]!.name}[2:2 + executionCalldataLength]; // Next bytes are the calldata`,
209209
`bytes32 typeHash = _hashTypedDataV4(keccak256(abi.encode(EXECUTION_TYPEHASH, ${fn.args[0]!.name}, ${fn.args[1]!.name},${!delayed ? ` _useNonce(${fn.args[0]!.name}),` : ''} ${fn.args[2]!.name}, executionCalldata)));`,
210210
];
@@ -335,7 +335,7 @@ function buildOnInstallFn(c: ContractBuilder, overrides: string[]) {
335335
const restOffset = `${argsOffset} + ${lengthName}`;
336336
comment += `uint16(${lengthName}), ${argsName}`;
337337
body.push(
338-
`uint16 ${lengthName} = uint16(uint256(bytes32(${fn.args[0]!.name}[${lengthOffset}:${argsOffset}]))); // First 2 bytes are the length`,
338+
`uint16 ${lengthName} = uint16(bytes2(${fn.args[0]!.name}[${lengthOffset}:${argsOffset}])); // First 2 bytes are the length`,
339339
`bytes calldata ${argsName} = ${fn.args[0]!.name}[${argsOffset}:${restOffset}]; // Next bytes are the args`,
340340
`${name}.onInstall(${argsName});`,
341341
);

0 commit comments

Comments
 (0)