chore: bump miden-protocol dependencies to 0.17.0-rc.4 - #2617
Conversation
Mirko-von-Leipzig
left a comment
There was a problem hiding this comment.
As mentioned in one of the comments, we should be using the actual miden-protobuf traits to replace all of our own TryFrom implementations.
Its unclear how much extra work that entails, so I'm okay with merging this as an intermediate form to unblock the client.
| .context("Failed to decode block header")? | ||
| .build_unchecked() | ||
| .context("Failed to build block header")?; |
There was a problem hiding this comment.
| .context("Failed to decode block header")? | |
| .build_unchecked() | |
| .context("Failed to build block header")?; | |
| .context("failed to decode block header")? | |
| .build_unchecked() | |
| .context("failed to build block header")?; |
| .context("Failed to decode block header")? | ||
| .build_unchecked() | ||
| .context("Failed to build block header") |
There was a problem hiding this comment.
| .context("Failed to decode block header")? | |
| .build_unchecked() | |
| .context("Failed to build block header") | |
| .context("failed to decode block header")? | |
| .build_unchecked() | |
| .context("failed to build block header") |
| let value: Word = match slot.content { | ||
| Some(SlotContent::Value(value)) => value.try_into().context("invalid slot value")?, | ||
| Some(SlotContent::MapRoot(_)) => { | ||
| anyhow::bail!("storage map slots are not supported for this account") | ||
| }, | ||
| None => anyhow::bail!("missing slot value"), | ||
| }; |
There was a problem hiding this comment.
This seems to be a common pattern; perhaps something we should make easier? e.g. .as_value() -> Result<&Value> so one can write
let value: Word = slot.content
.as_value()
.and_then(TryInto::try_into)
.context("not a storage slot value")?;| .decode_fields() | ||
| .context("failed to decode the funding note")? | ||
| .verify() | ||
| .context("failed to verify the funding note")?; |
There was a problem hiding this comment.
We should perhaps also make this easier. @kkovaacs perhaps we can add more extension traits that enable decode_and_verify() etc?
There was a problem hiding this comment.
There was a problem hiding this comment.
We shouldn't need these helpers. Instead we should be implementing the traits exposed by the miden-protobuf crate, same way the miden-objects crate does.
However, we can do that in a follow-up PR instead, which would let us merge quicker.
There was a problem hiding this comment.
This would also include making our proto schema more precise so perhaps this is ok.
There was a problem hiding this comment.
I'll add the changes as a PR stack on top of this one.
Summary
Upgrade to
miden-protocol0.17.0-rc.4. Needed to integrate the same version in the client.Main changes:
miden-protocolcrates from0.17.0-rc.3to0.17.0-rc.4.TryFrom<proto>conversion withdecode_fields()plus an explicitverify(),verify_with(context)orbuild_unchecked().verify_field,verify_value,verify_optionaland theverify!macro.Changelog