0xMiden / 0xMiden/miden-vm

Restore const modifier to Word::is_empty() once P3 supports const PartialEq

Aperta
#3,505 2 commenti 0 reazioni 1 assegnatario Rivendicata da @adr1anh Vedi su GitHub
merkle starks
Lingua principale
Rust
Stelle
772
Fork
352
Merge medio
1g 12h
PR unite (30g)
93

Descrizione

The `Word::is_empty()` method lost its `const` modifier during the Plonky3 migration because P3's `Felt` doesn't have a const `.inner()` method and `PartialEq` isn't const.

## Previous Implementation (const)

```rust
pub const fn is_empty(&self) -> bool {
const ZERO_FELT_INNER: u64 = Felt::ZERO.inner();

self.0[0].inner() == ZERO_FELT_INNER
&& self.0[1].inner() == ZERO_FELT_INNER
&& self.0[2].inner() == ZERO_FELT_INNER
&& self.0[3].inner() == ZERO_FELT_INNER
}
```

## Current Implementation (not const)

```rust
pub fn is_empty(&self) -> bool {
self.0[0] == Felt::ZERO
&& self.0[1] == Felt::ZERO
&& self.0[2] == Felt::ZERO
&& self.0[3] == Felt::ZERO
}
```

## Action Required

Once upstream Plonky3 adds support for const `PartialEq` and const field element operations, restore the `const` modifier to this method.

Part of 0xMiden/crypto#724

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.