diff --git a/.github/workflows/create-storage-change-log.yml b/.github/workflows/create-storage-change-log.yml new file mode 100644 index 00000000..6a91cddb --- /dev/null +++ b/.github/workflows/create-storage-change-log.yml @@ -0,0 +1,75 @@ +name: Create Storage Change Log + +on: + pull_request: + branches: + - mainnet + - testnet + - "release/*" + - "feature/*" + - "features/*" + +env: + FOUNDRY_PROFILE: ci + +jobs: + check: + strategy: + fail-fast: true + + name: Foundry project + runs-on: [self-hosted, dockerize] + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Update package with soldeer + run: forge soldeer update + + - name: Recursively update dependencies + run: | + chmod +x ./update-deps.sh + ./update-deps.sh + id: update-deps + + - name: Run Forge build + run: | + forge --version + forge build --skip scripts + id: build + + - name: "Setup Node" + uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 #v3.4.1 + with: + node-version: v16.16.0 + + - name: Storage Layout Check + run: | + echo "Checking storage layout..." + echo "Current branch: ${{ github.head_ref || github.ref_name }}" + echo "BASE_BRANCH: ${{ github.event.pull_request.base.ref }}" + echo "CURRENT_COMMIT_HASH: ${{ github.sha }}" + git fetch --unshallow || git fetch --all + dependencies/@storage-delta-0.3.1/run.sh ${{ github.event.pull_request.base.sha }} --omit new --contracts contracts + + - name: Check for storage_delta folder + id: check-folder + run: | + if [ -d "storage_delta" ]; then + echo "storage_delta_exists=true" >> $GITHUB_OUTPUT + fi + + - name: Commit and changes + if: steps.check-folder.outputs.storage_delta_exists == 'true' + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add storage_delta + git commit -m "Add contract layout changes [CI]" + git push origin HEAD:${{ github.head_ref || github.ref_name }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c05642a8..cc0cceee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,6 +8,8 @@ on: - "release/*" - "feature/*" - "features/*" + - "implement-feature/**" + - "implement-feature/**/**" pull_request: branches: - mainnet @@ -30,7 +32,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: recursive - + - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: @@ -55,3 +57,8 @@ jobs: run: | forge test --no-match-path '*forking/*' -vvv id: test + + - name: "Setup Node" + uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 #v3.4.1 + with: + node-version: v16.16.0 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7db535bd..ca76b48e 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,5 @@ deployments/**/exported_address config/config.json config/config.yaml dependencies -deployments/ronin-mainnet-shadow \ No newline at end of file +deployments/ronin-mainnet-shadow +.storage_delta_cache diff --git a/contracts/mocks/MockBridge.sol b/contracts/mocks/MockBridge.sol index b14dc6d3..67e8f696 100644 --- a/contracts/mocks/MockBridge.sol +++ b/contracts/mocks/MockBridge.sol @@ -6,6 +6,9 @@ import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol" import "../interfaces/IBridge.sol"; contract MockBridge is IBridge { + uint256 private _collisionVariable; + uint256 private _collisionVariable1; + uint256 private _collisionVariable2; /// @dev Mapping from validator address => last block that the bridge operator is added mapping(address => uint256) public bridgeOperatorAddedBlock; /// @dev Bridge operators array diff --git a/foundry.toml b/foundry.toml index 1c744d38..52511cf6 100644 --- a/foundry.toml +++ b/foundry.toml @@ -63,3 +63,4 @@ ronin-mainnet-shadow = "http://35.192.217.237:8545" "@openzeppelin-v5" = { version = "5.0.2", url = "https://github.com/OpenZeppelin/openzeppelin-contracts/archive/refs/tags/v5.0.2.zip" } "@chainlink" = { version = "1.6.0", url = "https://github.com/smartcontractkit/chainlink/archive/refs/tags/v1.6.0.zip" } safe-smart-account = { version = "1.4.1", url = "https://github.com/safe-global/safe-smart-account/archive/refs/tags/v1.4.1.zip" } +"@storage-delta" = { version = "0.3.1", url = "https://github.com/tringuyenskymavis/storage-delta/archive/refs/tags/0.3.1.zip" } diff --git a/remappings.txt b/remappings.txt index d9e8ba87..ddb2c03d 100644 --- a/remappings.txt +++ b/remappings.txt @@ -10,4 +10,5 @@ hardhat/=./node_modules/hardhat/ @fdk/=dependencies/@fdk-0.3.0-beta/script/ @contract-libs/=lib/foundry-deployment-kit/lib/contract-libs/src/ @chainlink/contracts/=dependencies/@chainlink-1.6.0/contracts/ -safe-smart-account/contracts/=dependencies/safe-smart-account-1.4.1/contracts/ \ No newline at end of file +safe-smart-account/contracts/=dependencies/safe-smart-account-1.4.1/contracts/ +@storage-delta-0.3.1=dependencies/@storage-delta-0.3.1 diff --git a/soldeer.lock b/soldeer.lock index bbd6d406..17cea34c 100644 --- a/soldeer.lock +++ b/soldeer.lock @@ -40,3 +40,9 @@ name = "safe-smart-account" version = "1.4.1" source = "https://github.com/safe-global/safe-smart-account/archive/refs/tags/v1.4.1.zip" checksum = "84348d4a1cf975f5d013cf8bdb74b8713bcccb40fceb5a1e7fc9debd27489e99" + +[[dependencies]] +name = "@storage-delta" +version = "0.3.1" +source = "https://github.com/TuDo1403/storage-delta/archive/refs/tags/0.3.1.zip" +checksum = "6ff6dad83b29fcec375d314c876c8731f37742363576b883d146824a7a57ab52"