Improve KeepOnlyLatestState/RemoveUntraceableBlocks/P2PStateExchangeExtensions behaviour #931

Open
opened 2025-12-28 17:14:41 +00:00 by sami · 1 comment
Owner

Originally created by @roman-khimov on GitHub (Jun 9, 2022).

We've got all the functionality needed, but I think we can improve the way users interact with it. There are two different worlds, public networks and private ones with P2PStateExchangeExtensions enabled and they have slightly different requirements. We can always strip all of the MPT data on non-P2PStateExchangeExtensions-enabled networks while we can't with this extensions enabled. The behavior we have now doesn't take P2PStateExchangeExtensions into account at all:

  • KeepOnlyLatestState=false with RemoveUntraceableBlocks=false keeps everything
  • KeepOnlyLatestState=true with RemoveUntraceableBlocks=false keeps all block/transfer data dropping all MPT data but the latest one
  • KeepOnlyLatestState=false with RemoveUntraceableBlocks=true keeps MaxTraceableBlocks number of MPTs and block/transfer data
  • KeepOnlyLatestState=true with RemoveUntraceableBlocks=true is essentially the same as KeepOnlyLatestState=false with RemoveUntraceableBlocks=true

This true/true combination is where the main problem is. While it's appropriate for P2PStateExchangeExtensions=true (otherwise other nodes won't be able to synchronize and we technically can't keep just three MPTs, all intermediate ones must also be kept); it's not exactly the best thing for public networks. They can be slightly more aggressive and store just one MPT while removing all of the other data wrt the MaxTraceableBlocks setting. This will optimize the data stored significantly (we know MPT is a huge part of the overall data set).

But KeepOnlyLatestState=true with RemoveUntraceableBlocks=false combination can also be improved for P2PStateExchangeExtensions=true, we can store MaxTraceableBlocks number of MPTs while keeping any other data.

Related to #2152.

Originally created by @roman-khimov on GitHub (Jun 9, 2022). We've got all the functionality needed, but I think we can improve the way users interact with it. There are two different worlds, public networks and private ones with P2PStateExchangeExtensions enabled and they have slightly different requirements. We can always strip all of the MPT data on non-P2PStateExchangeExtensions-enabled networks while we can't with this extensions enabled. The behavior we have now doesn't take P2PStateExchangeExtensions into account at all: * KeepOnlyLatestState=false with RemoveUntraceableBlocks=false keeps everything * KeepOnlyLatestState=true with RemoveUntraceableBlocks=false keeps all block/transfer data dropping all MPT data but the latest one * KeepOnlyLatestState=false with RemoveUntraceableBlocks=true keeps MaxTraceableBlocks number of MPTs and block/transfer data * KeepOnlyLatestState=true with RemoveUntraceableBlocks=true is essentially the same as KeepOnlyLatestState=false with RemoveUntraceableBlocks=true This true/true combination is where the main problem is. While it's appropriate for P2PStateExchangeExtensions=true (otherwise other nodes won't be able to synchronize and we technically can't keep just three MPTs, all intermediate ones must also be kept); it's not exactly the best thing for public networks. They can be slightly more aggressive and store just one MPT while removing all of the other data wrt the MaxTraceableBlocks setting. This will optimize the data stored significantly (we know MPT is a huge part of the overall data set). But KeepOnlyLatestState=true with RemoveUntraceableBlocks=false combination can also be improved for P2PStateExchangeExtensions=true, we can store MaxTraceableBlocks number of MPTs while keeping any other data. Related to #2152.
Author
Owner

@roman-khimov commented on GitHub (Jan 10, 2025):

It's specific to P2PStateExchangeExtensions and the extension itself may become irrelevant after https://github.com/neo-project/neo/issues/3463.

@roman-khimov commented on GitHub (Jan 10, 2025): It's specific to `P2PStateExchangeExtensions` and the extension itself may become irrelevant after https://github.com/neo-project/neo/issues/3463.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neo-go#931
No description provided.