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

LocalBlockchain different slot numbers #2043

Open
kadirchan opened this issue Feb 19, 2025 · 1 comment
Open

LocalBlockchain different slot numbers #2043

kadirchan opened this issue Feb 19, 2025 · 1 comment

Comments

@kadirchan
Copy link
Contributor

In Mina.LocalBlockchain, two methods currentSlot() and Mina.getNetworkState().globalSlotSinceGenesis gives different values than each other. Because while currentSlot() calculating current slot on each call it does not update local network state thus it needs to be updated manually by dev which is confusing.

@dfstio
Copy link

dfstio commented Feb 21, 2025

One is calculated using Date.now, and the other you can set manually on local, and on Zeko, you do not have slots. I use the following code to get and set slot in tests:

    let slot = (
      chain === "local"
        ? Mina.currentSlot()
        : chain === "zeko"
        ? UInt32.zero
        : (await fetchLastBlock()).globalSlotSinceGenesis
    ).toBigint();
...
local.incrementGlobalSlot(100);

I agree that it is quite confusing for developers, as all blockchains have different behaviours, and you cannot use local blockchain to test for devnet or Zeko.

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

No branches or pull requests

2 participants