ChainMovers / suibase

Sui development environment and cookbook.
https://suibase.io
Apache License 2.0
40 stars 6 forks source link

Add safe retry on failed "sui_getObject" JSON-RPC #107

Closed mario4tier closed 2 months ago

mario4tier commented 3 months ago

If a remote server does not have an expected Sui object, then may be another one has it...

Therefore, retry a "sui_getObject" when a server returns "notExists".

mario4tier commented 2 months ago

When a read-only JSON-RPC call returns "Not Exist"-like error, Suibase will retry the request up to 3 times with different servers (1 second delay in-between).

This fix is just a mitigation. Caller should consider possible race conditions between a mutating JSON-RPC and "read back" of its effects from potentially a different RPC server.

Changes applies to: sui_getEvents sui_getObject sui_tryGetPastObject suix_getDynamicFieldObject suix_getDynamicFields suix_getOwnedObjects

Related discussion: https://github.com/MystenLabs/walrus-sites/issues/109

kkomelin commented 2 months ago

Thank you