From b786cfafe724f4f2a3980fa2479da1051e712581 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:57:55 -0800 Subject: [PATCH] update RLP Tx tests --- test/Transactions.t.sol | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/test/Transactions.t.sol b/test/Transactions.t.sol index 9746cb7..93431a0 100644 --- a/test/Transactions.t.sol +++ b/test/Transactions.t.sol @@ -15,14 +15,11 @@ contract TestTransactions is Test { value: 10, nonce: 0, data: bytes(""), - chainId: 0, - v: abi.encodePacked(hex"1b"), - r: abi.encodePacked(hex"9bea4c4daac7c7c52e093e6a4c35dbbcf8856f1af7b059ba20253e70848d094f"), - s: abi.encodePacked(hex"8a8fae537ce25ed8cb5af9adac3f141af69bd515bd2ba031522df09b97dd72b1") + chainId: 0 }); bytes memory expected = abi.encodePacked( - hex"f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba09bea4c4daac7c7c52e093e6a4c35dbbcf8856f1af7b059ba20253e70848d094fa08a8fae537ce25ed8cb5af9adac3f141af69bd515bd2ba031522df09b97dd72b1" + hex"df800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a80808080" ); _testLegacyTransaction(txnWithToAddress, expected); @@ -33,19 +30,17 @@ contract TestTransactions is Test { value: 10, nonce: 1, data: abi.encodePacked(hex"02"), - chainId: 0, - v: abi.encodePacked(hex"1b"), - r: abi.encodePacked(hex"754a33a9c37cfcf61cd61939fd93f5fe194b7d1ee6ef07490e8c880f3bd0d87d"), - s: abi.encodePacked(hex"715bd50fa2c24e2ce0ea595025a44a39ac238558882f9f07dd885ddc51839419") + chainId: 0 }); - expected = abi.encodePacked( - hex"f84b010a82c350800a021ba0754a33a9c37cfcf61cd61939fd93f5fe194b7d1ee6ef07490e8c880f3bd0d87da0715bd50fa2c24e2ce0ea595025a44a39ac238558882f9f07dd885ddc51839419" - ); + expected = abi.encodePacked(hex"cb010a82c350800a02808080"); _testLegacyTransaction(txnWithoutToAddress, expected); } - function _testLegacyTransaction(Transactions.Legacy memory legacyTxn, bytes memory expectedRlp) public { + function _testLegacyTransaction( + Transactions.Legacy memory legacyTxn, + bytes memory expectedRlp + ) public { bytes memory rlp = Transactions.encodeRLP(legacyTxn); assertEq0(rlp, expectedRlp);