Skip to content

Feat/clue function#573

Open
theFirstCodeManiac wants to merge 17 commits into
Samuel1-ona:mainfrom
theFirstCodeManiac:feat/clue-function
Open

Feat/clue function#573
theFirstCodeManiac wants to merge 17 commits into
Samuel1-ona:mainfrom
theFirstCodeManiac:feat/clue-function

Conversation

@theFirstCodeManiac

Copy link
Copy Markdown
Contributor

Closes #101

Pull Request

Summary

Introduce a batch add_clues function to allow hunt creators to add multiple clues in a single transaction, significantly reducing the number of on chain transactions required to create large hunts.

Changes Made

  • Added add_clues(hunt_id, clues: Vec) for batch clue creation
  • Validated all clues before processing the batch
  • Reused existing clue creation logic where applicable
  • Preserved authorization and ownership checks for hunt creators
  • Ensured batch operations maintain contract state consistency

Problem

Creating hunts with dozens of clues currently requires one transaction per clue. This increases transaction costs, slows hunt creation, and creates a poor experience for creators building large hunts.

Solution

The new add_clues function accepts a collection of clues and processes them within a single transaction. This reduces transaction overhead while preserving existing validation and authorization guarantees.

Testing

  • Verified multiple clues can be added successfully in a single transaction
  • Verified batch additions correctly update hunt state
  • Verified invalid clue data causes the transaction to fail as expected
  • Verified only authorized hunt creators can perform batch additions
  • Compared transaction count before and after the change to confirm reduced on chain interactions

Performance Impact

  • Significantly reduces transaction count for large hunt creation
  • Lowers network fees for creators
  • Improves overall hunt creation workflow and scalability

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.

No batch add_clues function — creating large hunts requires many individual calls

1 participant