Skip to content

Revamp#7

Merged
cburgdorf merged 19 commits intomasterfrom
revamp
Mar 9, 2026
Merged

Revamp#7
cburgdorf merged 19 commits intomasterfrom
revamp

Conversation

@cburgdorf
Copy link
Copy Markdown
Collaborator

No description provided.

cburgdorf and others added 19 commits February 27, 2026 10:37
Replace the old multi-file ingot structure (13 .fe files) with a single
bountiful.fe using the new effects-based contract model. The 6 game
variants and trait system are consolidated into one Game contract due to
compiler limitations (StorageMap structs can't be passed as values,
tuple ABI arity cap).

Key changes:
- Contracts use msg/recv blocks instead of pub fn with Context
- Storage uses StorageMap effects instead of inline Map fields
- Cross-contract calls use Call effect instead of stub contracts
- Board stored in StorageMap<u256,u256> instead of Array<u256,16>
- Reverts replaced with error code returns
- 8 Fe-native tests (fe test) replace the old Hardhat test suite

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…er limitations

Split the single bountiful.fe into a proper Fe ingot structure:
- src/lib.fe: shared error codes, constants, helpers, cross-contract msg interfaces
- src/game.fe: Game contract (15-puzzle challenge)
- src/registry.fe: BountyRegistry contract (bounty platform)

The standalone bountiful.fe is kept for running tests (fe test only discovers
#[test] in the root module, and cross-module contract refs cause an ICE).

Add LIMITATIONS.md documenting 6 Fe compiler limitations for GitHub issues.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
GameBitboard (bitwise u256 board), Game2D (nested 2D arrays),
and GameEnum (enum/match/struct impl) — exercises distinct Fe
language features. All 14 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Delete the 1093-line monolith and activate the child module files in
src/. Tests now live in lib.fe and import contracts from child modules
via `use ingot::*`. All 14 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Port 7 new tests from the old JS test suite: non-admin register,
admin register+check, remove unlocked, remove while locked, claim
without lock, claim unregistered, claim unsolved.

Fix critical bug: all tests used args: (0,) as admin_inner, but
ctx.caller() in Fe test EVM is the test contract's address (not
Address::ZERO). Use evm.address().inner to correctly set admin.
This also fixes test_full_bounty_flow which was silently a no-op.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The workaround test was needed because the Fe test runner only checked
lib.fe for #[test] functions. This has been fixed upstream, so the
workaround can be removed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restructure the flat single-ingot project into a workspace with
dedicated ingots for better separation of concerns:

  shared   — error codes, constants, cross-contract msg interfaces,
             game_util helpers, DummyLockValidator test utility
  registry — BountyRegistry contract, DummyGame test utility
  games    — Game, Game2D, GameBitboard, GameEnum contracts

Dependency graph (no cycles):
  shared ← registry
  shared ← games

DummyLockValidator lives in shared (not games) so both registry and
games tests can deploy it without creating a circular dependency.
DummyGame in registry replaces the real Game contract in registry tests,
eliminating the games→registry→games cycle.

All 26 tests pass (shared: 1, registry: 14, games: 11).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Migrate e2e testing from Hardhat to Foundry to cover scenarios Fe's
test runner cannot: block advancement (vm.roll), ETH value transfers,
and multi-account authorization (vm.prank). 21 tests across two suites.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Deploys BountyRegistry + Game, registers the game as a challenge, and
initializes a solvable 15-puzzle board. Configurable lock deposit via
LOCK_DEPOSIT env var (default 0.01 ETH).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduce a shared Error enum with to_int() for type-safe,
sequential error codes (1-8) instead of scattered constants
with gaps. Update all contracts and Foundry test constants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Drop hardhat.config.js, package.json, old JS test files, and Hardhat
deployment scripts. Update .gitignore for Foundry build artifacts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
IGame pretended to be universal but didn't match all game variants
(game_2d has a different getBoard signature). The registry only needs
isSolved(), so that's the shared interface now. Tests and deploy script
define their own local IGame for variant-specific methods.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These APIs answer yes/no questions and should return bool instead of
u256. Also changes open_challenges map to StorageMap<Address, bool>.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cburgdorf cburgdorf merged commit 3fc668b into master Mar 9, 2026
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.

1 participant