From fc3ec5612c2c1bded95b49a48ffa97d0388eac07 Mon Sep 17 00:00:00 2001 From: pizzaman1337 Date: Tue, 17 Sep 2024 16:28:28 -0600 Subject: [PATCH] Update all L1RecieverFacets so they pass --- .../test/foundry/Migration/L1Reciever.t.sol | 94 ++++++++++++------- 1 file changed, 59 insertions(+), 35 deletions(-) diff --git a/protocol/test/foundry/Migration/L1Reciever.t.sol b/protocol/test/foundry/Migration/L1Reciever.t.sol index 80a7437e6..4e96d9581 100644 --- a/protocol/test/foundry/Migration/L1Reciever.t.sol +++ b/protocol/test/foundry/Migration/L1Reciever.t.sol @@ -6,7 +6,6 @@ import {TestHelper, LibTransfer, C, IMockFBeanstalk} from "test/foundry/utils/Te import {L1RecieverFacet} from "contracts/beanstalk/migration/L1RecieverFacet.sol"; import {Order} from "contracts/beanstalk/market/MarketplaceFacet/Order.sol"; import {LibBytes} from "contracts/Libraries/LibBytes.sol"; -import "forge-std/console.sol"; /** * @notice Tests the functionality of the L1RecieverFacet. @@ -26,15 +25,12 @@ contract L1RecieverFacetTest is Order, TestHelper { // contracts for testing: // note this is the first address numerically sorted in the merkle tree - address constant OWNER = address(0x153072C11d6Dffc0f1e5489bC7C996c219668c67); + address OWNER; address RECIEVER; function setUp() public { initializeBeanstalkTestState(true, false); - RECIEVER = applyL1ToL2Alias(OWNER); - console.log("RECIEVER:", RECIEVER); - // setup basic whitelisting for testing bs.mockWhitelistToken(L2BEAN, IMockFBeanstalk.beanToBDV.selector, 10000000000, 1); bs.mockWhitelistToken(L2URBEAN, IMockFBeanstalk.unripeBeanToBDV.selector, 10000000000, 1); @@ -53,6 +49,9 @@ contract L1RecieverFacetTest is Order, TestHelper { * @notice validates that an account verification works, with the correct data. */ function test_L2MigrateDeposits() public { + OWNER = address(0x153072C11d6Dffc0f1e5489bC7C996c219668c67); + RECIEVER = applyL1ToL2Alias(OWNER); + bs.setRecieverForL1Migration(OWNER, RECIEVER); ( @@ -66,10 +65,7 @@ contract L1RecieverFacetTest is Order, TestHelper { vm.prank(RECIEVER); L1RecieverFacet(BEANSTALK).issueDeposits(owner, depositIds, depositAmounts, bdvs, proof); - console.log("done issuing deposits"); - assertEq(bs.balanceOfStalk(RECIEVER), 9278633023225688000000); - console.log("done checking balance of stalk"); (address token, int96 stem) = LibBytes.unpackAddressAndStem(depositIds[0]); (uint256 amount, uint256 bdv) = bs.getDeposit(RECIEVER, token, stem); assertEq(amount, depositAmounts[0]); @@ -82,6 +78,8 @@ contract L1RecieverFacetTest is Order, TestHelper { } function test_L2MigratePlots() public { + OWNER = address(0x21DE18B6A8f78eDe6D16C50A167f6B222DC08DF7); + RECIEVER = applyL1ToL2Alias(OWNER); bs.setRecieverForL1Migration(OWNER, RECIEVER); ( @@ -103,6 +101,8 @@ contract L1RecieverFacetTest is Order, TestHelper { } function test_L2MigrateInternalBalances() public { + OWNER = address(0x20DB9F8c46f9cD438Bfd65e09297350a8CDB0F95); + RECIEVER = applyL1ToL2Alias(OWNER); bs.setRecieverForL1Migration(OWNER, RECIEVER); ( @@ -123,6 +123,8 @@ contract L1RecieverFacetTest is Order, TestHelper { } function test_L2MigrateFert() public { + OWNER = address(0x735CAB9B02Fd153174763958FFb4E0a971DD7f29); + RECIEVER = applyL1ToL2Alias(OWNER); bs.setRecieverForL1Migration(OWNER, RECIEVER); ( @@ -199,6 +201,8 @@ contract L1RecieverFacetTest is Order, TestHelper { * @notice verifies that a user cannot gain an invalid plot. */ function test_L2MigrateInvalidPlot() public { + OWNER = address(0x21DE18B6A8f78eDe6D16C50A167f6B222DC08DF7); + RECIEVER = applyL1ToL2Alias(OWNER); bs.setRecieverForL1Migration(OWNER, RECIEVER); ( @@ -216,6 +220,8 @@ contract L1RecieverFacetTest is Order, TestHelper { } function test_L2MigrateInvalidInternalBalance() public { + OWNER = address(0x20DB9F8c46f9cD438Bfd65e09297350a8CDB0F95); + RECIEVER = applyL1ToL2Alias(OWNER); bs.setRecieverForL1Migration(OWNER, RECIEVER); ( @@ -233,6 +239,8 @@ contract L1RecieverFacetTest is Order, TestHelper { } function test_L2MigrateInvalidFert() public { + OWNER = address(0x735CAB9B02Fd153174763958FFb4E0a971DD7f29); + RECIEVER = applyL1ToL2Alias(OWNER); bs.setRecieverForL1Migration(OWNER, RECIEVER); ( @@ -308,18 +316,28 @@ contract L1RecieverFacetTest is Order, TestHelper { internal returns (address, uint256[] memory, uint256[] memory, bytes32[] memory) { - address account = address(0x000000009d3a9e5C7c620514e1f36905C4Eb91e1); - - uint256[] memory index = new uint256[](1); - index[0] = 1000000; - - uint256[] memory pods = new uint256[](1); - pods[0] = 1000000; + address account = address(0x21DE18B6A8f78eDe6D16C50A167f6B222DC08DF7); + + uint256[] memory index = new uint256[](6); + index[0] = 633990925883216; + index[1] = 649972854809057; + index[2] = 666992136712860; + index[3] = 696658166381444; + index[4] = 696966636250825; + index[5] = 707711446117109; + + uint256[] memory pods = new uint256[](6); + pods[0] = 13743931655; + pods[1] = 310402500; + pods[2] = 5130435000; + pods[3] = 39926484; + pods[4] = 2347857; + pods[5] = 1525000; bytes32[] memory proof = new bytes32[](3); - proof[0] = bytes32(0x7fec66e420aacd9e183eccd924035325e315d9013f6f3d451bb9e858dffe90ec); - proof[1] = bytes32(0x5dea8270f7662bd619252f3e42834dceb9f5705b6519d3eeb3739eae266b82f4); - proof[2] = bytes32(0xc9661717e025decd79ae2e6f247415a52ff577c22bb4479239696b4d7fe0113f); + proof[0] = bytes32(0xce6c05520ca960525c486ec28de7ab8018c0d094a404feb043b60ef658e1e921); + proof[1] = bytes32(0x804c830f86722b4afe4c1e19fe9445e7b1087969871708451c204d4a1a333789); + proof[2] = bytes32(0xe59a902f19ff32a47a5eac21bb2642fb0e6c695edfed938122aed52a46a635c3); return (account, index, pods, proof); } @@ -328,18 +346,18 @@ contract L1RecieverFacetTest is Order, TestHelper { internal returns (address, address[] memory, uint256[] memory, bytes32[] memory) { - address account = address(0x000000009d3a9e5C7c620514e1f36905C4Eb91e1); + address account = address(0x20DB9F8c46f9cD438Bfd65e09297350a8CDB0F95); address[] memory tokens = new address[](1); - tokens[0] = address(0xBEA0000029AD1c77D3d5D23Ba2D8893dB9d1Efab); + tokens[0] = address(0x1BEA054dddBca12889e07B3E076f511Bf1d27543); uint256[] memory amounts = new uint256[](1); - amounts[0] = 1000000; + amounts[0] = 8568; bytes32[] memory proof = new bytes32[](3); - proof[0] = bytes32(0x6a57990edf1b67a414df7d4aec7b52e1c47286a03509d9c6f15a16b756a5de66); - proof[1] = bytes32(0x71d925b5e0154ae1869b233f58af5d6e9dbaa13be37c15c96e7a2349c7022ca6); - proof[2] = bytes32(0xafd548122a5e2e140737734c83cafd8d7299227d41232014a13e8454719fa366); + proof[0] = bytes32(0xe6b126b486d1049a3c4ea6d32708dedf47b9d508d591671eddd7214476914f69); + proof[1] = bytes32(0x88659cfb1b3bec548b7ac3b0c5dd1ff653cbc33e3a12e10fd6e7a554a0402f46); + proof[2] = bytes32(0x18679f0b3b62978601eb10e75699f4a869665f734fcca4c304a4d639e2c32f26); return (account, tokens, amounts, proof); } @@ -348,25 +366,31 @@ contract L1RecieverFacetTest is Order, TestHelper { internal returns (address, uint256[] memory, uint128[] memory, uint128, bytes32[] memory) { - address account = address(0x000000009d3a9e5C7c620514e1f36905C4Eb91e1); + address account = address(0x735CAB9B02Fd153174763958FFb4E0a971DD7f29); - uint256[] memory ids = new uint256[](1); - ids[0] = 1000000; + uint256[] memory ids = new uint256[](4); + ids[0] = 3458512; + ids[1] = 3458531; + ids[2] = 3470220; + ids[3] = 6000000; - uint128[] memory amounts = new uint128[](1); - amounts[0] = 1000000; + uint128[] memory amounts = new uint128[](4); + amounts[0] = 542767; + amounts[1] = 56044; + amounts[2] = 291896; + amounts[3] = 8046712; - uint128 lastBpf = 1000000000000; + uint128 lastBpf = 340802; bytes32[] memory proof = new bytes32[](3); - proof[0] = bytes32(0xd19d28ef2a071aa639c9393027a37d79d5fe98d72e92e3503e15919f197d2d85); - proof[1] = bytes32(0xb2de5943ed868a3e93502a344d36169678c761d3cc408a7b5b264c6fe9b3a4e9); - proof[2] = bytes32(0x0a2ec57dfd306a0e6b245cde079298f849cda3a3ba90016fa3216aac66a9ede3); + proof[0] = bytes32(0x044efadc8244d78f08686bb10b22ee313b8331aefafc0badffbb74c0558e3f8a); + proof[1] = bytes32(0xf6e0807e42179f8c975067c891e93ac48621024dc25b223baf4a78f0edcfa61d); + proof[2] = bytes32(0x7e77601c08f8772a9cf44337db2696d84da8290be446b231dc70c4289526a4d9); return (account, ids, amounts, lastBpf, proof); } - function getMockPodOrder() + /*function getMockPodOrder() internal returns (address, L1RecieverFacet.L1PodOrder[] memory, bytes32[] memory) { @@ -384,7 +408,7 @@ contract L1RecieverFacetTest is Order, TestHelper { proof[2] = bytes32(0x9dc791f184484213529aa44fad0074c356eb252777a3c9b0516efaf0fd740650); return (account, podOrders, proof); - } + }*/ /** * @notice Utility function that converts the address in the L1 that submitted a tx to