You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should probably change this from_block(0) to the latest block we've queried. I suggest the following. Since there are many calls, and the only public method is pub async fn fetch_from_root:
creates a new field in struct StateReader called last_queried_block.
in fetch_from_root, query the current latest block, and save it in a local variable latest_block.
pass this queried latest_block to all nested functions, since the latest block may change while we're querying along the chain of function calls. Change all the queries to_block to use latest_block.
change all requests to query from to use self.last_queried_block.
after finishing querying the state fetch_from_root updates self.last_queried_block to latest_block before returning.
We might have to change &self to &mut self, or use a Mutex. Both makes a lot of sense, since with this change fetch_from_root calls have to be mutually exclusive. With mutex, we'd need to acquire the lock before we do anything, and only release it once we finish everything. The &mut self approach accomplishes the same thing at the type system level (but now we won't be able to share pointers to StateReader ). I think I prefer the &mut self approach.
The text was updated successfully, but these errors were encountered:
Yeah, I may have read your comment too quickly as well. The state is built from scratch every fetch from the root tournament. We may not cache this last_queried_block, but still genesis block 0 is crazy, it should be a relative genesis block to the tournament and allow users to configure it dynamically.
The text was updated successfully, but these errors were encountered: