Skip to content

Conversation

@maximopalopoli
Copy link
Collaborator

@maximopalopoli maximopalopoli commented Jan 12, 2026

Description

This PR modifies the addSubscriptions behavior to only add to the active subscriptions counter when the address was not already subscribed.

How to test

Start the anvil node and deploy the anvil contracts with:

make ethereum_package_start

To fetch the current value of the active subscriptions counter:

cast call 0x922D6956C99E12DFeB3224DEA977D0939758A1Fe "activeSubscriptionsAmount()(uint256)"

To call the addSubscriptions method:

cast send 0x922D6956C99E12DFeB3224DEA977D0939758A1Fe \                                     
  "addSubscriptions(address[],uint256)" \
  "[0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266,0x70997970C51812dc3A010C7d01b50e0d17dc79C8,0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC]" \
 <UTC_SECONDS_TIMESTAMP> \
  --private-key 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97

The array of addresses can be changed.

The thing to test is that the counter does not change when the addresses are already subscribed.

Type of change

Please delete options that are not relevant.

  • New feature
  • Bug fix
  • Optimization
  • Refactor

Checklist

  • “Hotfix” to testnet, everything else to staging
  • Linked to Github Issue
  • This change depends on code or research by an external entity
    • Acknowledgements were updated to give credit
  • Unit tests added
  • This change requires new documentation.
    • Documentation has been added/updated.
  • This change is an Optimization
    • Benchmarks added/run
  • Has a known issue
  • If your PR changes the Operator compatibility (Ex: Upgrade prover versions)
    • This PR adds compatibility for operator for both versions and do not change crates/docs/examples
    • This PR updates batcher and docs/examples to the newer version. This requires the operator are already updated to be compatible

@maximopalopoli maximopalopoli self-assigned this Jan 12, 2026
@maximopalopoli maximopalopoli marked this pull request as ready for review January 12, 2026 18:48
for (uint256 i=0; i < addressesToAdd.length; ++i) {
address addressToAdd = addressesToAdd[i];

bool wasActive = subscribedAddresses[addressToAdd] > block.timestamp;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool wasActive = subscribedAddresses[addressToAdd] > block.timestamp;
bool isActive = subscribedAddresses[addressToAdd] > block.timestamp;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 286cd6a

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.

3 participants