feat(execution-engine,test-utils,interpreter-data,interpreter-cid)!: Rc into CID (#718)

* Hide `Rc` inside `CID` type, making it cheap to clone.
* Introduce `CidRef` type that abstracts on `CID`'s inner type.

This change makes code cleaner, makes memory more optimal (single allocation vs two allocations) and makes it easier to change CID's internal representation from string to binary.
This commit is contained in:
Ivan Boldyrev
2023-10-16 17:35:42 +04:00
committed by GitHub
parent d2ad221597
commit c2108e0fa0
27 changed files with 137 additions and 126 deletions

View File

@ -14,6 +14,9 @@
* limitations under the License.
*/
use std::rc::Rc;
use air_interpreter_cid::CidRef;
use thiserror::Error as ThisError;
#[derive(Debug, ThisError)]
pub enum DataVerifierError {
@ -29,7 +32,7 @@ pub enum DataVerifierError {
#[error("signature mismatch for {peer_id:?}: {error:?}, values: CIDS: {cids:?}")]
SignatureMismatch {
error: Box<fluence_keypair::error::VerificationError>,
cids: Vec<Box<str>>,
cids: Vec<Rc<CidRef>>,
peer_id: String,
},
@ -38,7 +41,7 @@ pub enum DataVerifierError {
)]
MergeMismatch {
peer_id: String,
larger_cids: Vec<Box<str>>,
smaller_cids: Vec<Box<str>>,
larger_cids: Vec<Rc<CidRef>>,
smaller_cids: Vec<Rc<CidRef>>,
},
}