feat: add InitialWearersAssigned event for subgraph User creation#81
Merged
feat: add InitialWearersAssigned event for subgraph User creation#81
Conversation
Allow organizations to define initial projects and tasks in deployment config, created atomically in the same transaction as org deployment. Includes JSON parsing, role index resolution, and bootstrap infrastructure in TaskManager. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add 10 bootstrap tests to TaskManager.t.sol covering: - Single/multiple projects, managers, role permissions - Bounty tasks, application-required tasks - Invalid inputs, empty arrays, full task lifecycle - Add bootstrap integration support to DeployerTest.t.sol - Add _emptyBootstrap() helper function - Update all 18 DeploymentParams to include bootstrap field - Fix deploy script type references: - Import ITaskManagerBootstrap from OrgDeployer.sol - Change OrgDeployer.ITaskManagerBootstrap -> ITaskManagerBootstrap - Add bootstrap parsing/building to RunOrgActions.s.sol and RunOrgActionsAdvanced.s.sol for full deploy script support - Pin OpenZeppelin submodule to v5.0.2 (correct version for codebase) All 557 tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Deploy deployer eligibility is now conditional on `canVote && mintToDeployer`, matching minting behavior. Executor remains eligible for all roles as needed for governance operations. This prevents unnecessary eligibility entries and ensures role config intent is fully respected. - Only set deployer eligibility when they're receiving the hat - Executor stays eligible for all roles (required for QuickJoin) - Update CLAUDE.md to document that upgrades/ is auto-generated by CI - All 547 tests pass Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…k' into hudsonhrh/hat-mint-eligible
Run forge fmt on merged code from org-deploy-project-task branch. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Defense-in-depth security improvement for the bootstrap system: - Add clearDeployer() function to TaskManager that can only be called by the deployer to permanently revoke bootstrap privileges - OrgDeployer now calls clearDeployer() after bootstrap phase completes - This prevents any future bootstrapProjectsAndTasks calls even if OrgDeployer were compromised Tests added: - test_ClearDeployerSuccess - test_ClearDeployerOnlyDeployer - test_ClearDeployerCannotBeCalledTwice - test_BootstrapThenClear - testFullOrgDeploymentWithBootstrapAndClearDeployer Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The executor receives admin authority via the topHat transfer, not by wearing individual role hats. This change removes unnecessary overhead: - Remove mintToExecutor field from RoleDistributionConfig struct - Remove executor from eligibility setup (was added to every role) - Remove executor from minting loop - Update deployment scripts and JSON configs - Update tests to reflect new struct shape The executor can still mint hats to users via its topHat admin authority. All 562 tests pass. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
During deployment, WearerEligibilityUpdated events are emitted before OrgDeployed, causing a timing issue in the subgraph where User entities cannot be created (EligibilityModuleContract doesn't exist yet). This PR adds a new InitialWearersAssigned event emitted after OrgDeployed that includes all addresses who received hats during deployment. The subgraph can then process this event to create User and RoleWearer entities with proper organization context. Changes: - Add InitialWearersAssigned event definition - Add _collectInitialWearers helper function - Emit event after OrgDeployed with wearer-to-hat mapping Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3 tasks
…o feat/initial-wearers-event
The _collectInitialWearers function referenced the removed mintToExecutor field from RoleDistributionConfig. This fix aligns the function with PR 80's changes that removed mintToExecutor from the struct. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
InitialWearersAssignedevent emitted afterOrgDeployedwith all wearer-to-hat mappings_collectInitialWearersto collect wearers from role configurationsProblem
During deployment,
WearerEligibilityUpdatedevents are emitted BEFOREOrgDeployed. When the subgraph processes these events, theEligibilityModuleContractentity doesn't exist yet (it's created byhandleOrgDeployed), so User entities cannot be created. This results in deployers not being recognized as org members immediately after deployment.Solution
Add a new event
InitialWearersAssignedthat is emitted AFTEROrgDeployed. Since events are processed in log index order, this event will be processed afterEligibilityModuleContractexists, allowing proper User creation.Changes
Event Definition: Added
InitialWearersAssigned(bytes32 indexed orgId, address indexed eligibilityModule, address[] wearers, uint256[] hatIds)Helper Function: Added
_collectInitialWearers()that iterates through role configurations and collects:mintToDeployeris true)mintToExecutoris true)additionalWearersEvent Emission: Emitted after
OrgDeployedin_deployFullOrgInternal()Test plan
forge build)mintToDeployer: true🤖 Generated with Claude Code