From 2af09224ea1a960ef16ddd917f1aa8be84217ffd Mon Sep 17 00:00:00 2001 From: DhairyaSethi <55102840+DhairyaSethi@users.noreply.github.com> Date: Tue, 9 Sep 2025 00:33:30 +0530 Subject: [PATCH 1/7] feat: increment a/RwaAToken revision --- src/contracts/instances/ATokenInstance.sol | 2 +- src/contracts/instances/RwaATokenInstance.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/contracts/instances/ATokenInstance.sol b/src/contracts/instances/ATokenInstance.sol index ab8dee10..7a6e2309 100644 --- a/src/contracts/instances/ATokenInstance.sol +++ b/src/contracts/instances/ATokenInstance.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; import {AToken, IPool, IAaveIncentivesController, IInitializableAToken, Errors, VersionedInitializable} from '../protocol/tokenization/AToken.sol'; contract ATokenInstance is AToken { - uint256 public constant ATOKEN_REVISION = 1; + uint256 public constant ATOKEN_REVISION = 2; constructor(IPool pool) AToken(pool) {} diff --git a/src/contracts/instances/RwaATokenInstance.sol b/src/contracts/instances/RwaATokenInstance.sol index 757ced02..8cd15c25 100644 --- a/src/contracts/instances/RwaATokenInstance.sol +++ b/src/contracts/instances/RwaATokenInstance.sol @@ -5,7 +5,7 @@ import {RwaAToken} from '../protocol/tokenization/RwaAToken.sol'; import {IPool, IAaveIncentivesController, IInitializableAToken, Errors, VersionedInitializable} from '../protocol/tokenization/AToken.sol'; contract RwaATokenInstance is RwaAToken { - uint256 public constant ATOKEN_REVISION = 1; + uint256 public constant ATOKEN_REVISION = 2; constructor(IPool pool) RwaAToken(pool) {} From 91ec6bd983a7bf2251951e9d320f1caaefca75ba Mon Sep 17 00:00:00 2001 From: DhairyaSethi <55102840+DhairyaSethi@users.noreply.github.com> Date: Tue, 9 Sep 2025 02:01:20 +0530 Subject: [PATCH 2/7] feat: fork test exec --- tests/deployments/ATokenRevision.t.sol | 69 ++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tests/deployments/ATokenRevision.t.sol diff --git a/tests/deployments/ATokenRevision.t.sol b/tests/deployments/ATokenRevision.t.sol new file mode 100644 index 00000000..b83b1233 --- /dev/null +++ b/tests/deployments/ATokenRevision.t.sol @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.0; + +import {Test} from 'forge-std/Test.sol'; +import {ATokenInstance, IPool} from 'src/contracts/instances/ATokenInstance.sol'; +import {DataTypes} from 'src/contracts/protocol/libraries/types/DataTypes.sol'; + +contract ATokenRevision_Base is Test { + uint256 internal _preExecSnapshot; + uint256 internal _postExecSnapshot; + IPool internal constant POOL = IPool(0xAe05Cd22df81871bc7cC2a04BeCfb516bFe332C8); + + address internal NEW_A_TOKEN_INSTANCE = 0xB2668573828029917ffbD1e76270373511818498; + address internal NEW_RWA_A_TOKEN_INSTANCE = 0x8CA2a49c7Df42E67F9A532F0d383D648fB7Fe4C9; + address internal NEW_REVENUE_SPLITTER = 0x70CC725B8f05e0f230B05C4e91ABc651E121354f; + + function setUp() public { + vm.createSelectFork('mainnet', 23320695); + _preExecSnapshot = vm.snapshotState(); + _execPayload(); + _postExecSnapshot = vm.snapshotState(); + } + + function test_exec() public view { + address[2] memory aTokenInstances = [NEW_A_TOKEN_INSTANCE, NEW_RWA_A_TOKEN_INSTANCE]; + + for (uint16 i = 0; i < POOL.getReservesCount(); ++i) { + ATokenInstance aToken = ATokenInstance( + POOL.getReserveData(POOL.getReserveAddressById(i)).aTokenAddress + ); + assertEq(aToken.RESERVE_TREASURY_ADDRESS(), NEW_REVENUE_SPLITTER); + + address aTokenImplementation = _getImplementation(address(aToken)); + assertTrue( + aTokenImplementation == aTokenInstances[0] || aTokenImplementation == aTokenInstances[1] + ); + } + } + + function test_reserveData() public { + for (uint16 i = 0; i < POOL.getReservesCount(); ++i) { + address reserve = POOL.getReserveAddressById(i); + vm.revertToState(_preExecSnapshot); + DataTypes.ReserveDataLegacy memory rData = POOL.getReserveData(reserve); + vm.revertToState(_postExecSnapshot); + assertEq(abi.encode(POOL.getReserveData(reserve)), abi.encode(rData)); + } + } + + function _getImplementation(address proxy) internal view virtual returns (address) { + bytes32 slot = bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1); + return address(uint160(uint256(vm.load(proxy, slot)))); + } + + function _execPayload() internal { + address EMERGENCY_MULTISIG = 0x13B57382c36BAB566E75C72303622AF29E27e1d3; + bytes + memory data = hex'6a761202000000000000000000000000a83c336b20401af773b6219ba5027174338d18360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011a000000000000000000000000000000000000000000000000000000000000010248d80ff0a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000fc80083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000040d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000b2668573828029917ffbd1e76270373511818498000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000144161766520486f72697a6f6e205257412047484f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a61486f7252776147484f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000b2668573828029917ffbd1e76270373511818498000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e2052574120555344430000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277615553444300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000008292bb45bf1ee4d140127049757c2e0ff06317ed00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000b2668573828029917ffbd1e76270373511818498000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000164161766520486f72697a6f6e2052574120524c55534400000000000000000000000000000000000000000000000000000000000000000000000000000000000c61486f72527761524c555344000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000043415eb6ff9db7e26a15b704e7a3edce97d31c4e00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e2052574120555354420000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277615553544200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000014d60e7fdc0d71d8611742720e4c50e7a974020c00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e2052574120555343430000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277615553434300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000136471a34f6ef19fe571effc1ca711fdb8e49f2b00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e2052574120555359430000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277615553594300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000008c213ee79581ff4984583c6a801e5263418c4b8600000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000164161766520486f72697a6f6e20525741204a5452535900000000000000000000000000000000000000000000000000000000000000000000000000000000000c61486f725277614a54525359000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000005a0f93d040de44e78f251b03c43be9cf317dcf6400000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e20525741204a4141410000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277614a4141410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000ce5004e7202b5194c53c0eed784cef2b96461e0b00000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000'; + vm.store(EMERGENCY_MULTISIG, bytes32(uint256(4)), bytes32(uint256(1))); // reset signer threshold to one + address SIGNER = 0xCe5004e7202b5194c53C0Eed784cEf2B96461e0b; + vm.prank(SIGNER); + (bool ok, bytes memory ret) = EMERGENCY_MULTISIG.call(data); + if (!ok) { + assembly { + revert(add(ret, 32), mload(ret)) + } + } + } +} From 28083f2e04ec581b3756736f4494c7da5286cdfe Mon Sep 17 00:00:00 2001 From: DhairyaSethi <55102840+DhairyaSethi@users.noreply.github.com> Date: Tue, 9 Sep 2025 02:38:25 +0530 Subject: [PATCH 3/7] test: improve multisig mock --- tests/deployments/ATokenRevision.t.sol | 37 ++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/tests/deployments/ATokenRevision.t.sol b/tests/deployments/ATokenRevision.t.sol index b83b1233..299b3c41 100644 --- a/tests/deployments/ATokenRevision.t.sol +++ b/tests/deployments/ATokenRevision.t.sol @@ -29,6 +29,7 @@ contract ATokenRevision_Base is Test { POOL.getReserveData(POOL.getReserveAddressById(i)).aTokenAddress ); assertEq(aToken.RESERVE_TREASURY_ADDRESS(), NEW_REVENUE_SPLITTER); + assertEq(aToken.ATOKEN_REVISION(), 2); address aTokenImplementation = _getImplementation(address(aToken)); assertTrue( @@ -54,12 +55,29 @@ contract ATokenRevision_Base is Test { function _execPayload() internal { address EMERGENCY_MULTISIG = 0x13B57382c36BAB566E75C72303622AF29E27e1d3; + address TARGET = 0x9641d764fc13c8B624c04430C7356C1C7C8102e2; // safe transaction batcher bytes - memory data = hex'6a761202000000000000000000000000a83c336b20401af773b6219ba5027174338d18360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011a000000000000000000000000000000000000000000000000000000000000010248d80ff0a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000fc80083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000040d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000b2668573828029917ffbd1e76270373511818498000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000144161766520486f72697a6f6e205257412047484f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a61486f7252776147484f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000b2668573828029917ffbd1e76270373511818498000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e2052574120555344430000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277615553444300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000008292bb45bf1ee4d140127049757c2e0ff06317ed00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000b2668573828029917ffbd1e76270373511818498000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000164161766520486f72697a6f6e2052574120524c55534400000000000000000000000000000000000000000000000000000000000000000000000000000000000c61486f72527761524c555344000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000043415eb6ff9db7e26a15b704e7a3edce97d31c4e00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e2052574120555354420000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277615553544200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000014d60e7fdc0d71d8611742720e4c50e7a974020c00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e2052574120555343430000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277615553434300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000136471a34f6ef19fe571effc1ca711fdb8e49f2b00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e2052574120555359430000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277615553594300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000008c213ee79581ff4984583c6a801e5263418c4b8600000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000164161766520486f72697a6f6e20525741204a5452535900000000000000000000000000000000000000000000000000000000000000000000000000000000000c61486f725277614a54525359000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000005a0f93d040de44e78f251b03c43be9cf317dcf6400000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e20525741204a4141410000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277614a4141410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000ce5004e7202b5194c53c0eed784cef2b96461e0b00000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000'; + memory TARGET_CALLDATA = hex'8d80ff0a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000fc80083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000040d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000b2668573828029917ffbd1e76270373511818498000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000144161766520486f72697a6f6e205257412047484f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a61486f7252776147484f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000b2668573828029917ffbd1e76270373511818498000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e2052574120555344430000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277615553444300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000008292bb45bf1ee4d140127049757c2e0ff06317ed00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000b2668573828029917ffbd1e76270373511818498000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000164161766520486f72697a6f6e2052574120524c55534400000000000000000000000000000000000000000000000000000000000000000000000000000000000c61486f72527761524c555344000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000043415eb6ff9db7e26a15b704e7a3edce97d31c4e00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e2052574120555354420000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277615553544200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000014d60e7fdc0d71d8611742720e4c50e7a974020c00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e2052574120555343430000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277615553434300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000136471a34f6ef19fe571effc1ca711fdb8e49f2b00000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e2052574120555359430000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277615553594300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000008c213ee79581ff4984583c6a801e5263418c4b8600000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000164161766520486f72697a6f6e20525741204a5452535900000000000000000000000000000000000000000000000000000000000000000000000000000000000c61486f725277614a54525359000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083cb1b4af26eef6463ac20afbac9c0e2e017202f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4bb01c37c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000005a0f93d040de44e78f251b03c43be9cf317dcf6400000000000000000000000070cc725b8f05e0f230b05c4e91abc651e121354f0000000000000000000000001d5d386a90cea8acea9fa75389e97cf5f1ae21d300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000008ca2a49c7df42e67f9a532f0d383d648fb7fe4c9000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000154161766520486f72697a6f6e20525741204a4141410000000000000000000000000000000000000000000000000000000000000000000000000000000000000b61486f725277614a4141410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'; vm.store(EMERGENCY_MULTISIG, bytes32(uint256(4)), bytes32(uint256(1))); // reset signer threshold to one address SIGNER = 0xCe5004e7202b5194c53C0Eed784cEf2B96461e0b; vm.prank(SIGNER); - (bool ok, bytes memory ret) = EMERGENCY_MULTISIG.call(data); + (bool ok, bytes memory ret) = EMERGENCY_MULTISIG.call( + abi.encodeCall( + ISafeAccount.execTransaction, + ( + TARGET, + 0, // value + TARGET_CALLDATA, + 1, // operation, 1 => delegatecall + 0, // safeTxGas + 0, // baseGas + 0, // gasPrice + 0x0000000000000000000000000000000000000000, // gasToken + payable(0x0000000000000000000000000000000000000000), // refundReceiver + abi.encodePacked(bytes32(uint256(uint160(SIGNER))), bytes32(0), uint8(1)) // r, s, v + ) + ) + ); if (!ok) { assembly { revert(add(ret, 32), mload(ret)) @@ -67,3 +85,18 @@ contract ATokenRevision_Base is Test { } } } + +interface ISafeAccount { + function execTransaction( + address to, + uint256 value, + bytes calldata data, + uint8 operation, + uint256 safeTxGas, + uint256 baseGas, + uint256 gasPrice, + address gasToken, + address payable refundReceiver, + bytes memory signatures + ) external payable returns (bool success); +} From 28bb2e73aa0bdda8a222805a578a4800448e1907 Mon Sep 17 00:00:00 2001 From: DhairyaSethi <55102840+DhairyaSethi@users.noreply.github.com> Date: Tue, 9 Sep 2025 02:39:44 +0530 Subject: [PATCH 4/7] chore: minor cleanup --- tests/deployments/ATokenRevision.t.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/deployments/ATokenRevision.t.sol b/tests/deployments/ATokenRevision.t.sol index 299b3c41..3e8eee8f 100644 --- a/tests/deployments/ATokenRevision.t.sol +++ b/tests/deployments/ATokenRevision.t.sol @@ -8,11 +8,11 @@ import {DataTypes} from 'src/contracts/protocol/libraries/types/DataTypes.sol'; contract ATokenRevision_Base is Test { uint256 internal _preExecSnapshot; uint256 internal _postExecSnapshot; - IPool internal constant POOL = IPool(0xAe05Cd22df81871bc7cC2a04BeCfb516bFe332C8); - address internal NEW_A_TOKEN_INSTANCE = 0xB2668573828029917ffbD1e76270373511818498; - address internal NEW_RWA_A_TOKEN_INSTANCE = 0x8CA2a49c7Df42E67F9A532F0d383D648fB7Fe4C9; - address internal NEW_REVENUE_SPLITTER = 0x70CC725B8f05e0f230B05C4e91ABc651E121354f; + IPool internal constant POOL = IPool(0xAe05Cd22df81871bc7cC2a04BeCfb516bFe332C8); + address internal constant NEW_A_TOKEN_INSTANCE = 0xB2668573828029917ffbD1e76270373511818498; + address internal constant NEW_RWA_A_TOKEN_INSTANCE = 0x8CA2a49c7Df42E67F9A532F0d383D648fB7Fe4C9; + address internal constant NEW_REVENUE_SPLITTER = 0x70CC725B8f05e0f230B05C4e91ABc651E121354f; function setUp() public { vm.createSelectFork('mainnet', 23320695); From 1d69310251d2afea9a6931467143297b1c7c3c93 Mon Sep 17 00:00:00 2001 From: DhairyaSethi <55102840+DhairyaSethi@users.noreply.github.com> Date: Tue, 9 Sep 2025 03:04:12 +0530 Subject: [PATCH 5/7] chore: minor cleanup --- tests/deployments/ATokenRevision.t.sol | 34 +++++++++----------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/tests/deployments/ATokenRevision.t.sol b/tests/deployments/ATokenRevision.t.sol index 3e8eee8f..71e816bb 100644 --- a/tests/deployments/ATokenRevision.t.sol +++ b/tests/deployments/ATokenRevision.t.sol @@ -61,28 +61,18 @@ contract ATokenRevision_Base is Test { vm.store(EMERGENCY_MULTISIG, bytes32(uint256(4)), bytes32(uint256(1))); // reset signer threshold to one address SIGNER = 0xCe5004e7202b5194c53C0Eed784cEf2B96461e0b; vm.prank(SIGNER); - (bool ok, bytes memory ret) = EMERGENCY_MULTISIG.call( - abi.encodeCall( - ISafeAccount.execTransaction, - ( - TARGET, - 0, // value - TARGET_CALLDATA, - 1, // operation, 1 => delegatecall - 0, // safeTxGas - 0, // baseGas - 0, // gasPrice - 0x0000000000000000000000000000000000000000, // gasToken - payable(0x0000000000000000000000000000000000000000), // refundReceiver - abi.encodePacked(bytes32(uint256(uint160(SIGNER))), bytes32(0), uint8(1)) // r, s, v - ) - ) - ); - if (!ok) { - assembly { - revert(add(ret, 32), mload(ret)) - } - } + ISafeAccount(EMERGENCY_MULTISIG).execTransaction({ + to: TARGET, + value: 0, + data: TARGET_CALLDATA, + operation: 1, // 1 => delegatecall + safeTxGas: 0, + baseGas: 0, + gasPrice: 0, + gasToken: 0x0000000000000000000000000000000000000000, + refundReceiver: payable(0x0000000000000000000000000000000000000000), + signatures: abi.encodePacked(uint256(uint160(SIGNER)), uint256(0), uint8(1)) // r, s, v + }); } } From 0c61ca4a89e5de3dfc1ad8017b7286b90a8457c4 Mon Sep 17 00:00:00 2001 From: YBM <31329384+yan-man@users.noreply.github.com> Date: Mon, 8 Sep 2025 18:43:31 -0500 Subject: [PATCH 6/7] test: snapshot clean up; atoken data --- tests/deployments/ATokenRevision.t.sol | 78 ++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 6 deletions(-) diff --git a/tests/deployments/ATokenRevision.t.sol b/tests/deployments/ATokenRevision.t.sol index 71e816bb..8348a709 100644 --- a/tests/deployments/ATokenRevision.t.sol +++ b/tests/deployments/ATokenRevision.t.sol @@ -38,16 +38,67 @@ contract ATokenRevision_Base is Test { } } - function test_reserveData() public { - for (uint16 i = 0; i < POOL.getReservesCount(); ++i) { + struct ATokenData { + string name; + string symbol; + uint8 decimals; + uint256 totalSupply; + address incentivesController; + uint256 scaledTotalSupply; + bytes32 domainSeparator; + address underlyingAssetAddress; + address pool; + } + + function test_aTokenData() public { + uint256 poolReservesCount = POOL.getReservesCount(); + + ATokenData[] memory aTokenDataPrev = new ATokenData[](poolReservesCount); + ATokenData[] memory aTokenDataNew = new ATokenData[](poolReservesCount); + + vm.revertToState(_postExecSnapshot); + for (uint16 i = 0; i < poolReservesCount; ++i) { address reserve = POOL.getReserveAddressById(i); - vm.revertToState(_preExecSnapshot); - DataTypes.ReserveDataLegacy memory rData = POOL.getReserveData(reserve); - vm.revertToState(_postExecSnapshot); - assertEq(abi.encode(POOL.getReserveData(reserve)), abi.encode(rData)); + ATokenInstance aTokenInstanceNew = ATokenInstance(POOL.getReserveAToken(reserve)); + aTokenDataNew[i] = _loadATokenData(aTokenInstanceNew); + assertEq(aTokenInstanceNew.RESERVE_TREASURY_ADDRESS(), NEW_REVENUE_SPLITTER, 'treasury addr'); + assertEq(aTokenInstanceNew.ATOKEN_REVISION(), 2, 'revision'); } + + vm.revertToState(_preExecSnapshot); + for (uint16 i = 0; i < poolReservesCount; ++i) { + address reserve = POOL.getReserveAddressById(i); + ATokenInstance aTokenInstancePrev = ATokenInstance(POOL.getReserveAToken(reserve)); + aTokenDataPrev[i] = _loadATokenData(aTokenInstancePrev); + assertEq(aTokenInstancePrev.ATOKEN_REVISION(), 1); + } + + assertEq(abi.encode(aTokenDataPrev), abi.encode(aTokenDataNew), 'aTokenData'); } + function test_reserveData() public { + uint256 poolReservesCount = POOL.getReservesCount(); + DataTypes.ReserveDataLegacy[] memory rDataNew = new DataTypes.ReserveDataLegacy[]( + poolReservesCount + ); + DataTypes.ReserveDataLegacy[] memory rData = new DataTypes.ReserveDataLegacy[]( + poolReservesCount + ); + + vm.revertToState(_postExecSnapshot); + for (uint16 i = 0; i < poolReservesCount; ++i) { + address reserve = POOL.getReserveAddressById(i); + rDataNew[i] = POOL.getReserveData(reserve); + } + + vm.revertToState(_preExecSnapshot); + for (uint16 i = 0; i < poolReservesCount; ++i) { + address reserve = POOL.getReserveAddressById(i); + rData[i] = POOL.getReserveData(reserve); + } + + assertEq(abi.encode(rData), abi.encode(rDataNew), 'reserveData'); + } function _getImplementation(address proxy) internal view virtual returns (address) { bytes32 slot = bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1); return address(uint160(uint256(vm.load(proxy, slot)))); @@ -74,6 +125,21 @@ contract ATokenRevision_Base is Test { signatures: abi.encodePacked(uint256(uint160(SIGNER)), uint256(0), uint8(1)) // r, s, v }); } + + function _loadATokenData(ATokenInstance aToken) internal view returns (ATokenData memory) { + return + ATokenData({ + name: aToken.name(), + symbol: aToken.symbol(), + decimals: aToken.decimals(), + totalSupply: aToken.totalSupply(), + incentivesController: address(aToken.getIncentivesController()), + scaledTotalSupply: aToken.scaledTotalSupply(), + domainSeparator: aToken.DOMAIN_SEPARATOR(), + underlyingAssetAddress: aToken.UNDERLYING_ASSET_ADDRESS(), + pool: address(aToken.POOL()) + }); + } } interface ISafeAccount { From 743a14569dfda335567e77f8d4fb8c326df9560a Mon Sep 17 00:00:00 2001 From: YBM <31329384+yan-man@users.noreply.github.com> Date: Mon, 8 Sep 2025 20:34:18 -0500 Subject: [PATCH 7/7] test: skip prev tests --- tests/deployments/HorizonPhaseOneListing.t.sol | 1 + tests/deployments/HorizonPhaseOneUpdate.t.sol | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/deployments/HorizonPhaseOneListing.t.sol b/tests/deployments/HorizonPhaseOneListing.t.sol index 8f6ad958..cbd2fd67 100644 --- a/tests/deployments/HorizonPhaseOneListing.t.sol +++ b/tests/deployments/HorizonPhaseOneListing.t.sol @@ -978,6 +978,7 @@ contract HorizonPhaseOneListingTest is HorizonListingMainnetTest, Default { } function initEnvironment() internal override { + vm.skip(true); super.initEnvironment(); whitelistSuperstateRwa(pool.getReserveAToken(USTB_ADDRESS)); diff --git a/tests/deployments/HorizonPhaseOneUpdate.t.sol b/tests/deployments/HorizonPhaseOneUpdate.t.sol index 180de28d..38ced69e 100644 --- a/tests/deployments/HorizonPhaseOneUpdate.t.sol +++ b/tests/deployments/HorizonPhaseOneUpdate.t.sol @@ -41,6 +41,7 @@ contract HorizonPhaseOneUpdateTest is HorizonPhaseOneListingTest { } function setUp() public virtual override { + vm.skip(true); super.setUp(); loadUpdatedParams(); }