Skip to content

Feat/initialize facet operational counter#1065

Open
marcosio wants to merge 21 commits intodevelopmentfrom
feat/InitializeFacet-operational-counter
Open

Feat/initialize facet operational counter#1065
marcosio wants to merge 21 commits intodevelopmentfrom
feat/InitializeFacet-operational-counter

Conversation

@marcosio
Copy link
Copy Markdown
Contributor

@marcosio marcosio commented May 6, 2026

Description

Type of change

  • Bug fix 🐞
  • New feature ✨
  • Breaking change 💥
  • Documentation update 📖
  • Refactor 🔧

Testing

Node version:

  • 20
  • 22
  • 24

Checklist

  • Style Guidelines followed ✅
  • Documentation Updated 📚
  • Linters - No New Warnings ⚠️
  • Local Tests Pass ✅
  • Effective Tests Added ✔️
  • No reduction of Coverage

AlbertoMolinaIoBuilders and others added 8 commits April 29, 2026 14:34
Signed-off-by: Alberto Molina <alberto@io.builders>
Signed-off-by: Alberto Molina <alberto@io.builders>
Signed-off-by: Alberto Molina <alberto@io.builders>
Signed-off-by: Alberto Molina <alberto@io.builders>
Signed-off-by: Alberto Molina <alberto@io.builders>
…eFacet

Signed-off-by: Alberto Molina <alberto@io.builders>
Signed-off-by: Marcos Serradilla Diez <marcos@io.builders>
…tializer

Each setFacetToReady now increments a counter; when it reaches
configTargetCount the config transitions to operational atomically,
emitting TokenOperational with no separate setOperationalStatus call
needed — O(1) regardless of config size.

Adds _prepareReinitialization for upgrade flows (k=0 → immediate;
k>0 → REINIT_PENDING with target). Refactors facetVersionStatus and
facetLastVersion to composite keccak256 keys to prevent cross-context
collisions. Extends IInitializer with TokenOperational, setConfigTargetCount,
getConfigInitializedCount and getConfigTargetCount.

Includes GasBenchmarkInitializerHarness, gas benchmark tests asserting
O(1) cost at N={1,5,10,25,50,100} under the Hedera 7.5M limit, and
ADR-002 documenting the decision and rejected alternatives.

Backward compatible: target=0 (default) is a no-op and preserves the
existing setOperationalStatus flow.

Signed-off-by: Marcos Serradilla Diez <marcos@io.builders>
@marcosio marcosio marked this pull request as ready for review May 6, 2026 12:47
@marcosio marcosio requested review from a team as code owners May 6, 2026 12:47
@marcosio marcosio requested review from mgarbs and rbarker-dev May 6, 2026 12:47
themariofrancia and others added 12 commits May 6, 2026 17:24
Signed-off-by: Mario Francia <mariofranciarius@gmail.com>
Signed-off-by: Marcos Serradilla Diez <marcos@io.builders>
Signed-off-by: jaime-iobermudez <jaime.bermudez@io.builders>
…20 (#1003)

Signed-off-by: Marcos Serradilla Diez <marcos@io.builders>
Signed-off-by: Alberto Molina <alberto@io.builders>
Signed-off-by: Marcos Serradilla Diez <marcos@io.builders>
Co-authored-by: Marcos Serradilla Diez <marcos@io.builders>
Signed-off-by: jaime-iobermudez <jaime.bermudez@io.builders>
Replace 101 parallel eth_call to getStaticResolverKey() with offline
lookup via atsRegistry.getFacetDefinition(). Hedera Solo JSON-RPC relay
rate-limits the concurrent reads; Hardhat tolerates them. Resolver keys
are deterministic and already available in the generated registry, so
no on-chain round-trip is needed.

Two follow-on fixes:
- error()/warn()/debug() now print the data argument in text mode
  (Error name+message+stack, ethers reason/shortMessage/code/data, or
  JSON for plain objects). Previously the data was silently dropped in
  text mode, masking the real exception body in CI logs.
- registerFacets() batch loop hardened: Math.ceil + strict <, plus a
  defensive empty-slice guard. Previously sent an empty final tx when
  facets.length % FACET_REGISTRATION_BATCH_SIZE === 0.

Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
…ation

Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
Signed-off-by: Axel-IoBuilders <108282711+Axel-IoBuilders@users.noreply.github.com>
Signed-off-by: jaime-iobermudez <jaime.bermudez@io.builders>
Co-authored-by: jaime-iobermudez <jaime.bermudez@io.builders>
Signed-off-by: mamoralesiob <miguelangel@io.builders>
Signed-off-by: jaime-iobermudez <jaime.bermudez@io.builders>
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.

7 participants