ChainSafe / ChainSafe/forest

Spike: owned Blockstore

Open
#3,221 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
697
Forks
200
Avg merge
1d 5h
Merged PRs (30d)
65

Description

**Issue summary**

At the moment, the `fvm_ipld_blockstore::Blockstore` trait we are using does not accept owned values in the `put_keyed` method, which conflicts with the ParityDb API, which accepts only owned values. This makes Forest perform additional allocation on every entry write, which is suboptimal.

We could propose changing the trait to accept a [Cow](https://doc.rust-lang.org/std/borrow/enum.Cow.html). Accepting an owned value will most likely not be accepted given the Go FFI does not need to perform any additional allocations. See the [unsafe code](https://github.com/filecoin-project/filecoin-ffi/blob/de34caff946d598edb299566d951b44b9b7f7dd4/rust/src/fvm/blockstore/cgo.rs#L133-L139).

Before doing that, it'd be great to assess if and how it improves performance.

**Other information and links**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.