Skip to content
Merged
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
11 changes: 8 additions & 3 deletions src/sig/SignatureLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,14 @@ library SignatureLib {
bytes32 rpIdHash = sha256(bytes(rpId));
bytes memory authData = abi.encodePacked(rpIdHash, WEBAUTHN_FLAG_UP, bytes4(0));
string memory challengeB64 = base64UrlEncode(abi.encodePacked(challenge));
bytes memory clientDataJSON =
abi.encodePacked('{"type":"webauthn.get","challenge":"', challengeB64, '","origin":"', origin, '"}');
return abi.encodePacked(authData, clientDataJSON);
bytes memory clientDataJSON = bytes.concat(
bytes('{"type":"webauthn.get","challenge":"'),
bytes(challengeB64),
bytes('","origin":"'),
bytes(origin),
bytes('"}')
);
return bytes.concat(authData, clientDataJSON);
}

/// @notice Computes the P256 message hash signed by a WebAuthn assertion.
Expand Down
3 changes: 3 additions & 0 deletions src/tx/Eip1559TransactionLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ library Eip1559TransactionLib {

/// @notice Creates a new EIP-1559 transaction with default values.
function create() internal view returns (Eip1559Transaction memory tx_) {
require(block.chainid <= type(uint64).max, "chain ID exceeds uint64");
// Safe after the explicit range check above.
// forge-lint: disable-next-line(unsafe-typecast)
tx_.chainId = uint64(block.chainid);
tx_.gasLimit = 21000;
}
Expand Down
3 changes: 3 additions & 0 deletions src/tx/Eip7702TransactionLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ library Eip7702TransactionLib {

/// @notice Creates a new EIP-7702 transaction with default values.
function create() internal view returns (Eip7702Transaction memory tx_) {
require(block.chainid <= type(uint64).max, "chain ID exceeds uint64");
// Safe after the explicit range check above.
// forge-lint: disable-next-line(unsafe-typecast)
tx_.chainId = uint64(block.chainid);
tx_.gasLimit = 21000;
}
Expand Down
8 changes: 4 additions & 4 deletions src/tx/TxRlp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ library TxRlp {
if (len == 1 && uint8(str[0]) < 0x80) {
return str;
} else if (len <= 55) {
return abi.encodePacked(bytes1(uint8((0x80 + len) & 0xff)), str);
return bytes.concat(bytes1(uint8((0x80 + len) & 0xff)), str);
} else {
bytes memory lenBytes = encodeLength(len);
return abi.encodePacked(bytes1(uint8((0xb7 + lenBytes.length) & 0xff)), lenBytes, str);
return bytes.concat(bytes1(uint8((0xb7 + lenBytes.length) & 0xff)), lenBytes, str);
}
}

Expand All @@ -92,10 +92,10 @@ library TxRlp {
function prependListPrefix(bytes memory payload) internal pure returns (bytes memory) {
uint256 len = payload.length;
if (len <= 55) {
return abi.encodePacked(bytes1(uint8((0xc0 + len) & 0xff)), payload);
return bytes.concat(bytes1(uint8((0xc0 + len) & 0xff)), payload);
} else {
bytes memory lenBytes = encodeLength(len);
return abi.encodePacked(bytes1(uint8((0xf7 + lenBytes.length) & 0xff)), lenBytes, payload);
return bytes.concat(bytes1(uint8((0xf7 + lenBytes.length) & 0xff)), lenBytes, payload);
}
}

Expand Down