Skip to content

refactor: migrate from custom bitmask to EnumerableSet architecture#217

Closed
rplusq wants to merge 1 commit into
WalletConnect:feat/contractfrom
rplusq:feat/contract
Closed

refactor: migrate from custom bitmask to EnumerableSet architecture#217
rplusq wants to merge 1 commit into
WalletConnect:feat/contractfrom
rplusq:feat/contract

Conversation

@rplusq

@rplusq rplusq commented Jun 10, 2025

Copy link
Copy Markdown
Collaborator

Description

This is a follow-up PR on top of @xDarksome #212. My goal was to keep Rust/WCN integration almost unchanged while modernising the Solidity internals.

What changed (one-liner each)

  • Membership: custom 256-slot bitmask → OpenZeppelin EnumerableSet.
  • Ownership: custom owner fields → Ownable2Step (safer hand-off).
  • NodeOperator struct: now includes maintenance boolean (replaces separate mapping).
  • Migration FSM: same API, but isPulling set in a single loop (gas –5 k/op).
  • On-chain maintenance toggle: setMaintenance(bool) emits MaintenanceToggled.
  • Custom errors replace string reverts.
  • Settings & version: every mutator bumps version for subgraph indexing.

Integration side of things

  • All public getters (getCurrentKeyspace, getMigrationStatus, …) unchanged.
  • Events names unchanged + new MaintenanceToggled (ignored by nodes until used).
  • Gas profile: startMigration(16 ops) ≈ 140 k, setMaintenance ≈ 20 k.
  • Migration-to-main-net plan (unchanged)
  • Backend points to new address, runs e2e tests.

@xDarksome : please confirm events + getters still fit alloy bindings. No single getView() now, so you might have to join with multiCall on the alloy side: https://alloy.rs/guides/multicall#multicall-with-alloy

All forge tests green; ready for merge once you’re happy.

@rplusq rplusq changed the base branch from main to feat/contract June 10, 2025 15:23
@rplusq rplusq closed this by deleting the head repository Jun 10, 2025
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