filecoin-project / specs-actors

DEPRECATED Specification of builtin actors, in the form of executable code.
Other
86 stars 102 forks source link

Reconsider inline cids #1457

Open ZenGround0 opened 3 years ago

ZenGround0 commented 3 years ago

@ribasushi brought up the idea of revisiting the inline cid idea as a way to address the growing state tree. There is a lot of technical disagreement and background in this closed PR: https://github.com/filecoin-project/specs-actors/pull/783.

Stebalien commented 3 years ago

We should definitely test this, but I'm a bit skeptical that this will help with sector infos, at least. Those are already inlined into the AMT and have no sub-fields that can be inlined.

However, we could probably save a bit of space by reducing the overhead of the AMT. But not much space, in this case.

ribasushi commented 1 year ago

@ZenGround0 @Stebalien @raulk bumping this again + its sibling https://github.com/filecoin-project/specs-actors/pull/783#discussion_r466736366

This might be filecoin's very last chance to make a change here, as after the FEVM user-defined contracts will be anchoring to preexisting CIDs, ossifying their expected shape forever.

Moreover: with user-defined smart contracts it is very likely that a lot more small objects will be generated than before.

Stebalien commented 1 year ago

We should definitely consider this for M2.2. One alternative to "inline" CIDs is to just "auto-inline" small objects. I did some experimentation in https://github.com/Stebalien/ipld-exp/blob/master/src/auto_link.rs and it seems feasible.

Given that, you'd write something like:

struct MyState {
    some_field: AutoLink<SomeValue>,
}

And SomeValue would get auto-inlined if smaller than some constant size.