Skip to content

Conversation

@h4x3rotab
Copy link
Contributor

No description provided.

@h4x3rotab h4x3rotab marked this pull request as draft July 23, 2025 10:34
@Leechael Leechael mentioned this pull request Jul 28, 2025
h4x3rotab and others added 18 commits November 20, 2025 04:42
- Add Foundry configuration (foundry.toml) with OpenZeppelin remappings
- Migrate all Hardhat tests to Foundry Solidity tests
- Add comprehensive test coverage for DstackKms and DstackApp contracts
- Implement upgrade testing with OpenZeppelin Foundry plugin
- Create dedicated test files for core functionality vs upgrade testing
- Add contract deployment scripts for Foundry
- Include test utility contracts (DstackAppV1, DstackKmsV1) for upgrade scenarios
- Fix compilation issues with Address library usage
- Add detailed README with testing instructions and project overview

Test Status:
✅ DstackApp.t.sol: 11/11 tests PASS - Core app functionality
✅ DstackKms.t.sol: 16/16 tests PASS - Core KMS functionality
✅ UpgradesBasic.t.sol: 5/5 tests PASS - Basic upgrade functionality
⚠️ Advanced upgrade tests have OpenZeppelin validation issues

Total: 32/32 core and basic upgrade tests PASSING

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Remove all Hardhat dependencies while preserving bootAuth server:

🗑️ Removed Hardhat components:
- Config files: hardhat.config.ts, jest.integration.config.js
- Hardhat test files: test/*.test.ts, test/setup.ts
- TypeChain generated types: typechain-types/ directory
- Deployment scripts: scripts/deploy.ts, upgrade.ts, verify.ts
- Build artifacts: .openzeppelin/, cache files
- Dependencies: All @nomicfoundation/hardhat-* packages

✅ Preserved & Updated:
- BootAuth server: src/server.ts, main.ts, types.ts (fully functional)
- EthereumBackend: Updated to use ethers Contract directly (no TypeChain)
- Server tests: Moved main.test.ts to src/ (4 tests passing)
- Foundry setup: All contracts and tests working (32/32 tests passing)
- Package.json: Added Foundry test scripts, removed Hardhat deps
- Documentation: Updated README with server endpoints and usage

🎯 Final architecture:
- Foundry: Smart contract development and testing
- Node.js: HTTP API server for TEE boot validation
- Zero Hardhat dependencies

All tests passing:
- Foundry: 32/32 core contract tests ✅
- Server: 4/4 HTTP API tests ✅
- TypeScript compilation: Success ✅

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove all files from out/ directory (Foundry build output)
- Add /out to .gitignore to prevent tracking build artifacts
- Clean up repository by excluding generated files

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove Upgrades.t.sol (duplicate functionality)
- Remove UpgradesBasic.t.sol (only using plugin-based upgrades)
- Keep UpgradesWithPlugin.t.sol as the comprehensive upgrade test suite
- Update README documentation to reflect simplified test structure
- Maintain 27/27 core functionality tests passing

This streamlines the test suite by keeping only the most comprehensive
upgrade tests that use the OpenZeppelin Foundry Upgrades plugin.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Create modular test scripts for better flexibility
- Add setup-local-chain.sh to start Anvil and deploy contracts
- Add run-tests.sh to run tests against existing chain
- Add test-all.sh for complete test runs
- Add cleanup.sh to stop all test processes
- Update .gitignore to exclude test logs and env files
- Remove old monolithic test-with-anvil.sh script
- Add comprehensive documentation in scripts/README.md

This allows developers to:
- Set up chain once and run tests multiple times
- Run different test suites independently
- Better integrate with CI/CD pipelines
- Debug issues more easily with separate logs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Update test coverage to show all 36 tests passing (100% success)
- Add documentation for new modular testing scripts
- Include local integration testing workflow instructions
- Add deployment script documentation
- Remove outdated notes about failing tests

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Replace foundry-cast-cheatsheet.md with migration notice
- Remove duplicate Interact.s.sol file
- Remove duplicate ShowKmsInfo from Manage.s.sol
- Streamline README.md, TESTING.md to focus on essentials
- Update script/README.md to remove development notes
- All Cast operations now covered by type-safe Foundry scripts

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Remove --with-foundry flag and associated npm scripts. Foundry tests now
always run as part of the standard test suite.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Move .github/workflows/test.yml from kms/auth-eth to repository root
- Rename to foundry-test.yml for clarity
- Add --ffi flag to forge test command (required for OpenZeppelin upgrades plugin)
- Configure workflow to only run on kms/auth-eth/** path changes
- Set working-directory to kms/auth-eth for all steps
- Fix empty build-info JSON file issue that was causing test failures

All 36 tests now passing:
- 16 DstackKms tests
- 11 DstackApp tests
- 9 Upgrade tests with OpenZeppelin plugin

🤖 Generated with [Claude Code](https://claude.ai/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add view modifier to test_Initialize() in DstackApp.t.sol
- Add view modifier to test_SupportsInterface() in DstackApp.t.sol
- Add view modifier to test_Initialize() in DstackKms.t.sol
- Add view modifier to test_SupportsInterface() in DstackKms.t.sol

This resolves Solidity compiler warnings about function state mutability
and makes the code more explicit about which test functions only read state.

🤖 Generated with [Claude Code](https://claude.ai/claude-code)

Co-Authored-By: Claude <[email protected]>
Run forge fmt to apply consistent formatting to all Solidity files:
- Update interface definitions formatting
- Improve multi-line function declarations
- Standardize spacing and indentation
- Format test files and scripts

🤖 Generated with [Claude Code](https://claude.ai/claude-code)

Co-Authored-By: Claude <[email protected]>
@h4x3rotab h4x3rotab marked this pull request as ready for review November 20, 2025 11:12
Comment on lines +23 to +53
name: Foundry project
runs-on: ubuntu-latest
defaults:
run:
working-directory: kms/auth-eth
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Show Forge version
run: |
forge --version
- name: Run Forge fmt
run: |
forge fmt --check
id: fmt

- name: Run Forge build
run: |
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test --ffi -vvv
id: test

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 7 days ago

To fix the problem, you should add a permissions block to the workflow. This block can be added either at the root level (applying to all jobs unless individually overridden) or specifically to the check job shown. The minimal starting point for most build/test pipelines is contents: read — this prevents the workflow from making any modifications to repository content, but still allows it to check out code and read repository metadata. Add the following at the top level of the workflow (after the name: key is typical), e.g. after line 5. No imports or definitions are needed; just a one-line-permission YAML key insert.

Suggested changeset 1
.github/workflows/foundry-test.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/foundry-test.yml b/.github/workflows/foundry-test.yml
--- a/.github/workflows/foundry-test.yml
+++ b/.github/workflows/foundry-test.yml
@@ -3,6 +3,8 @@
 # SPDX-License-Identifier: Apache-2.0
 
 name: KMS Auth-ETH Foundry Tests
+permissions:
+  contents: read
 
 on:
   push:
EOF
@@ -3,6 +3,8 @@
# SPDX-License-Identifier: Apache-2.0

name: KMS Auth-ETH Foundry Tests
permissions:
contents: read

on:
push:
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants