dojo icon indicating copy to clipboard operation
dojo copied to clipboard

sozo: remove the need of `world_block`

Open glihm opened this issue 11 months ago • 6 comments

Currently, sozo needs to fetch data from the world to have compare it to the local representation of it.

However, on public networks, when too much blocks are in the network, the nodes are refusing returning data if the block range used to get events is too big.

As a temporary fix, sozo is relying on a world_block parameter: https://github.com/dojoengine/dojo/blob/a2f00edecc32932ddd3a6e2d09c3ae164c925d04/crates/dojo/world/src/config/environment.rs#L13

And this is used in sozo here: https://github.com/dojoengine/dojo/blob/a2f00edecc32932ddd3a6e2d09c3ae164c925d04/bin/sozo/src/commands/events.rs#L65-L71

The idea of this issue, is to remove this world_block, and instead making smaller block ranges if sozo detects the block range is too wide. The exact limit of blocks is not benched yet, but 50k blocks could be a good start.

*** EDIT ***

The most important part to update with this PR is actually where we are rebuilding the remote world. Currently this is a big issue since the world is not rebuilt correctly which impacts almost all the commands. sozo event is the only command doing the raw logic since we need raw events access.

https://github.com/dojoengine/dojo/blob/c9895953e485168aeb61e26843ed73bd8f7b67a4/crates/dojo/world/src/remote/events_to_remote.rs#L26

glihm avatar Dec 19 '24 16:12 glihm

Can I handle this task?

pheobeayo avatar Dec 19 '24 16:12 pheobeayo

Can I handle this task?

Yep, feel free to ask on the dojo discord or here if you have any question!

glihm avatar Dec 19 '24 16:12 glihm

@pheobeayo how are you going on this? Any update?

glihm avatar Dec 30 '24 05:12 glihm

@glihm I will be making a PR soon

pheobeayo avatar Dec 30 '24 07:12 pheobeayo

@glihm can you reassign this issue to me?

okhaimie-dev avatar Jan 22 '25 04:01 okhaimie-dev

@pheobeayo is also interested to learn, don't hesitate to catch up with @okhaimie-dev to collaborate on that if you're willing to.

@okhaimie-dev I've also updated the issue, with what needs to be adjusted. Thanks for your contribution guys.

glihm avatar Jan 22 '25 04:01 glihm