Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 4ff174d Author: IronGauntlets <aneequesafdar@gmail.com> Date: Fri Apr 26 22:10:44 2024 +0100 Move pending to sync package In order to moved handling of pending to synchroniser the following changes needed to be made: - Add database to synchroniser, so that pending state can be served - Blockchain and Events Filter have a pendingBlockFn() which returns the pending block. Due to import cycle pending struct could not be referenced, therefore, the anonymous function is passed. - Add PendingBlock() to return just the pending block, this was mainly added to support the pendingBlockFn(). - In rpc package the pending block and state is retrieved through synchroniser. Therefore, receipt and transaction handler now check the pending block for the requested transaction/receipt. commit fb75cd6 Author: IronGauntlets <aneequesafdar@gmail.com> Date: Fri Apr 26 15:18:33 2024 +0100 Rename cachedPending to pending commit 3ffc458 Author: IronGauntlets <aneequesafdar@gmail.com> Date: Fri Apr 26 01:27:53 2024 +0100 Check pending block protocol version before storing commit 317ca38 Author: IronGauntlets <aneequesafdar@gmail.com> Date: Fri Apr 26 00:52:59 2024 +0100 Refactor blockchain.Pending to return a reference commit 03f4bfa Author: IronGauntlets <aneequesafdar@gmail.com> Date: Mon Apr 22 21:16:22 2024 +0100 Remove pending and empty pending from DB Pending Block is now only managed in memory this is to make sure that pending block in the DB and in memory do not become out of sync. Before the pending block was managed in memory as a cache, however, since there is only one pending block at a given time it doesn't make sense to keep track of pending block in both memory and DB. To reduce the number of block not found errors while simulating transactions it was decided to store empty pending block, using the latest header to fill in fields such as block number, parent block hash, etc. This meant that any time we didn't have a pending block this empty pending block would be served along with empty state diff and classes. Every time a new block was added to the blockchain a new empty pending block was also added to the DB. The unforeseen side effect of this change was when the --poll-pending-interval flag was disabled the rpc would still serve a pending block. This is incorrect behaviour. As the blocks changed per new versions of starknet the empty block also needed to be changed and a storage diff with a special contract "0x1" needed to be updated in the state diff. This overhead is unnecessary and incorrectly informs the user that there is a pending block when there isn't one.
- Loading branch information