Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Previous Messages Resent to L1 on Katana Restart #2033

Open
ybensacq opened this issue Jun 9, 2024 · 4 comments · May be fixed by #2354
Open

Previous Messages Resent to L1 on Katana Restart #2033

ybensacq opened this issue Jun 9, 2024 · 4 comments · May be fixed by #2354
Assignees
Labels
bug Something isn't working katana This issue is related to Katana

Comments

@ybensacq
Copy link
Contributor

ybensacq commented Jun 9, 2024

Describe the bug
When running Katana with the command
katana --messaging anvil.messaging.json --db-dir ./database
previously sent messages to L2 are resent to L1 upon restarting Katana.

To Reproduce
Steps to reproduce the behavior:

  1. Follow all the steps in the starknet-messaging-dev repo, except start Katana with: katana --messaging anvil.messaging.json --db-dir ./database
  2. Stop katana
  3. Restart katana using katana --messaging anvil.messaging.json --db-dir ./database (wait for a few seconds)
  4. Observe that previously sent messages are resent to L1.

Expected behavior
Messages should not be resent to L1 upon restarting Katana; the state should persist correctly between restarts.

@ybensacq ybensacq added the bug Something isn't working label Jun 9, 2024
@glihm glihm added the katana This issue is related to Katana label Jun 10, 2024
@glihm
Copy link
Collaborator

glihm commented Jun 11, 2024

@kariy would have any pointer on that one?

@StarkFishinator
Copy link

Hi, can I get assigned to this?

@glihm glihm added this to the 1.0.0 milestone Jun 19, 2024
@glihm glihm changed the title [katana] Previous Messages Resent to L1 on Katana Restart Previous Messages Resent to L1 on Katana Restart Jun 19, 2024
@glihm
Copy link
Collaborator

glihm commented Jun 19, 2024

This seemed to be caused by the messaging service not having context of where to start the message processing.

messenger,
gather_from_block,
send_from_block: 0,
msg_gather_fut: None,
msg_send_fut: None,

For gathering the messages from the L1, we have an item in the configuration that may be used for that. However, as we're using a database, this block number may be different if Katana stops without graceful shutdown.

Currently, on the providers traits we have, there's no trait to store messaging information (last block gathered, last block sent messages). @kariy does it sound reasonable to add a provider trait to store such information and allow Katana to restart from an existing database being aware of which blocks must be processed for L1 <> L2 messaging?

@StarkFishinator are you feeling confident to dive into that? Or do you have an other strategy to propose?

@glihm glihm assigned glihm and kariy Jun 19, 2024
@glihm glihm modified the milestones: 1.0.0-alpha, 1.0.0-rc Jul 7, 2024
@glihm glihm removed this from the 1.0.0-rc milestone Aug 13, 2024
@glihm
Copy link
Collaborator

glihm commented Aug 20, 2024

@ybensacq we've synced with @kariy and here's the way we could solve that:

  1. Katana has a genesis configuration and this is where we want the initial configuration for the L1 block to start fetching messages:
  2. Then, Katana should keep into the database some pointer on the block/transaction/event (we should evaluate the better) from where the message is actually fetched. To ensure correct restart when a database is used. We could have a new provider trait to handle those pointers.
  3. In the case of appchain->base_layer messages, we don't think it's necessary to have them into the genesis or messaging configuration. As when Katana is started with a database, the pointer will be enough to resume the operation.

@glihm glihm assigned ybensacq and unassigned glihm and kariy Aug 20, 2024
@ybensacq ybensacq linked a pull request Aug 28, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working katana This issue is related to Katana
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants