dojoengine / dojo

Dojo is a toolchain for building provable games and autonomous worlds with Cairo
https://dojoengine.org
Apache License 2.0
407 stars 165 forks source link

[Katana] Migration error on forked katana #1356

Closed broody closed 8 months ago

broody commented 9 months ago

Describe the bug After forking katana with a world already deployed, sozo migrate against the fork with the same build artifacts deployed to the original katana results in error.

To Reproduce Reproducible locally and using slot.

  1. Start first instance katana --disabe-fee
  2. Build spawn-and-move sozo build && sozo migrate
  3. Start second instance with fork katana --rpc-url http://localhost:5050 --disable-fee --fork-block-number 11 --port 1234
  4. sozo migrate --rpc-url http://localhost:1234 (comment out rpc-url in scarb)

Log error

2024-01-03T23:29:47.385606Z ERROR forked_backend: error while parsing legacy class 0x4d07e40e93398ed3c76981e72dd1fd22557a78ce36c0515f679e27f0bb5bc5f: missing field `type` at line 1 column 17647
2024-01-03T23:29:47.385637Z  WARN executor: Transaction validation error: ValidateTransactionError(StateError(StateReadError("missing field `type` at line 1 column 17647")))

Expected behavior Sozo migrate should complete successfully logging all contracts already deployed.

glihm commented 8 months ago

@kariy I've tested the merged changes on dev/katana, I've now this behavior:

2024-01-09T17:57:28.354771Z TRACE forked_backend: requesting class at hash 0x16c6081eb34ad1e0c5513234ed0c025b3c7f305902d291bad534cd6474c85bc
2024-01-09T17:57:28.356509Z  WARN executor: Transaction validation error: ValidateTransactionError(StateError(UndeclaredClassHash(ClassHash(StarkFelt("0x016c6081eb34ad1e0c5513234ed0c025b3c7f305902d291bad534cd6474c85bc")))))

Looks like the forked network does not find the new account account class hash in it's state.

kariy commented 8 months ago

Looks like the forked network does not find the new account account class hash in it's state.

Yes, hence this PR #1404

glihm commented 8 months ago

Looks like the forked network does not find the new account account class hash in it's state.

Yes, hence this PR #1404

Arg sorry, didn't make the match here. Thanks sensei. :pray:

glihm commented 8 months ago

Fixed by #1404, I've tested the steps in the issue and works as expected. Thanks guys!