Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getters for witness fields #160

Merged
merged 2 commits into from
Aug 6, 2022
Merged

Conversation

SebastienGllmt
Copy link
Contributor

I'm not sure what is the policy for flattening fields for Pallas. Presumably based on the way blocks and txs are handled, the policy is to flatten stuff when it's shared between eras? Based on this I added some getters for the witness types

@scarmuega
Copy link
Member

@SebastienGllmt thanks for adding this!

I'm not sure what is the policy for flattening fields for Pallas. Presumably based on the way blocks and txs are handled, the policy is to flatten stuff when it's shared between eras? Based on this I added some getters for the witness types

Yes, exactly, the idea is to flatten anything that shares a common primitive.

Since we're returning a borrow already, do you think that we can expose it as a slice instead of MaybeIndefArray?

I was thinking of something like this:

pub fn bootstrap_witness(&self) -> Option<&[BootstrapWitness]> {
    match self {
        Self::AlonzoCompatible(x) => x.bootstrap_witness.as_ref().map(|x| x.as_ref()),
        Self::Babbage(x) => x.bootstrap_witness.as_ref().map(|x| x.as_ref()),
        _ => None,
    }
}

Would great to expose as little as possible of all this nasty cbor wrappers.

@SebastienGllmt
Copy link
Contributor Author

done

@scarmuega scarmuega merged commit 74d5731 into txpipe:main Aug 6, 2022
@SebastienGllmt SebastienGllmt deleted the witness-getters branch August 6, 2022 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants