Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Pruning doesn't have expected behavior #14758

Open
@nazar-pc

Description

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

It might be the way it was designed to work, but it doesn't match my expectations for sure.

I have a node with pruning set to 256 and in this state:

2023-08-11 19:26:17.810  INFO tokio-runtime-worker substrate: [Consensus] 💤 Idle (8 peers), best: #67057 (0xea54…203c), finalized #9199 (0xa7b7…02b7), ⬇ 1.1kiB/s ⬆ 3.0kiB/s    

I expect that at this point node doesn't have anything stored for blocks below 9199. In practice, however:

  • When I query block 500 I can successfully get its hash 0x150e9d30d092aa25db6d11ebf24086ba67bc9ff83b2f1991577a10e2592b5b58

  • By hash I can also query the header:

    {
      parentHash: 0x1ea8fbb2e1fa5f21613481bab824fe4aaf7824bd3ca6d82dbb2d055270467e7f
      number: 500
      stateRoot: 0x41049e0d1f418981eef01de3ea3e6e2a3aec09a02071031fb9a183db28828478
      extrinsicsRoot: 0x04e0b4b8b4d2d096d7d400e1453dde2a411e5296c38db308b8a9677bf886f25b
      digest: {
        logs: [
          {
            PreRuntime: [
              SUB_
              0xf405663200000000a059a80f412639968079620d0258cc07c68a259046fc758834ccd5360299f95dfef81b6c484aaf9816c0e9c13d8b7cd29a1172028cfd6fda93465fd8766d4f7f030001000000000000001f0391a12379effeb4e24e39ba6b1cc8909674a4ff57ae8b841f2d8c5e6a4e9bee94bee71c532d29f99339c5e3bcd1033aa1b59429fe1c9a48ea2e292e2ccae39e0f0a6f445d76dd5b1db128238ad20b8c647baaa1a3451a522c8487c25c730bb438b42551e7a8163af882786ba35523033e6ba7eb538c666f0b30ec5d30f8299a138293412a6c5a82e30e0032a7ac6e9bca7cf7988aebd3e397d186a77f692d28227e369c0a7e8cd708f5f9c49a95a320e8017845b089fdf15638ad49a5410287cde157826e5ee3e675c0c7e85f6648e531bc56cb81039a5659774d47339fb364b4a83b2d75525dbbdabadc9ed6cd92485345ecc38cd8e6208b1fbaebc2f7e4691a85462da3fe591d3fbdd89962b673ea49679ec717168f783e7db4085db99fc506526cc986433bfb3cd9d3832f0de5f0eddf8a94bf9dc28f398e
            ]
          }
          {
            Consensus: [
              SUB_
              0x00ab3c10209c72085eacb74a13469748795c01242006770e2e7579eec0ca8fbfe2
            ]
          }
          {
            Consensus: [
              SUB_
              0x010000ecc367d81500
            ]
          }
          {
            Seal: [
              SUB_
              0x70f3c60c9c0a87ebab137153f4154f5f6e83e5960fdea4ccfd614dc0e77c5f76c194a27162447a29d73ab7b39e5e4702c97324e1d5d4b5f71141c8cdb642b782
            ]
          }
        ]
      }
    }
    

Block body (through RPC) returns null, which also causes confusion in Rust world where it is None, so block request kind of succeeds, but returns no extrinsics, which disrupts expectation of developers (we had some confusion in the past because of this).

The expectation here was to have bounded disk usage by limiting how many blocks and related data we store on disk, however it seems like storage will grow infinitely instead.

Inc case this is a desired behavior I'd like to know why and please consider this is a feature request to add header pruning.

Steps to reproduce

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions