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

offChain State does not update internal state #1935

Open
kadirchan opened this issue Nov 29, 2024 · 0 comments
Open

offChain State does not update internal state #1935

kadirchan opened this issue Nov 29, 2024 · 0 comments

Comments

@kadirchan
Copy link
Contributor

For a few weeks I have been doing on chain testing in my application that uses offChain state api. I use services in my app that send and settle the proofs I receive from users to Mina and this services work consistently.

However, after updating on offchain state, I realized that the api was not working correctly. When I tried to update again it after the updates were done, I was getting a root mismatch error and the only way to solve it was to restart the service.

I thought the problem might be that it was not settling and tested for that. After sending the update, I waited for it to settle completely, but the problem was the same. Then I console logged the states in some places on offchain-state.js and got the following results.

19127837625513839750015801518488884205754193410383643610887852957945537699566
first check false second check false
action state 18571608787403596221185729134339335640005846451227827507499404664500316550112
merkle map 4822366981302605685996191473523237511494367078661562577361822805082477390442
map root 4822366981302605685996191473523237511494367078661562577361822805082477390442 state root 4822366981302605685996191473523237511494367078661562577361822805082477390442
first check true second check true
returning internal
Current session 2009824360
2009824360  ->  2115950408
Generating proof
Transaction sent

## I waited for update and settlement here ##

19127837625513839750015801518488884205754193410383643610887852957945537699566
first check true second check true
returning internal
map root 4822366981302605685996191473523237511494367078661562577361822805082477390442 state root 19818629034789886366259936965517333313478084681883682142698168018525779052913
Error: root mismatch
Field.assertEquals(): 4822366981302605685996191473523237511494367078661562577361822805082477390442 != 19818629034789886366259936965517333313478084681883682142698168018525779052913

in the part

    let map = await Provable.witnessAsync(
      IndexedMerkleMapN,
      async () => (await merkleMaps()).merkleMap
    );

returns old map state and this causes root mismatch error, also I cannot figure out how to update this internal merkleMap.

the condition inside

       if (
        internal.merkleMap.root.toString() !== emptyMerkleMapRoot.toString() ||
        internal.valueMap.size > 0
      )

gives true || true despite of actual tree is updated.

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

1 participant