> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Hardfork.lte

> Check if hardfork is less than or equal to target

<Card title="Try it Live" icon="play" href="https://playground.tevm.sh?example=primitives/hardfork.ts">
  Run Hardfork examples in the interactive playground
</Card>

<Tabs />

## Operator-Style API

`lte` mimics the ≤ operator for clearer code:

```typescript theme={null}
import { LONDON, CANCUN } from 'tevm'

// Operator-style (reads like <= operator)
if (LONDON.lte(CANCUN)) {
  // ...
}

// Equivalent using isBefore + equals
if (Hardfork.isBefore(LONDON, CANCUN) || Hardfork.equals(LONDON, CANCUN)) {
  // ...
}
```

## Usage Patterns

### Maximum Version Checks

```typescript theme={null}
import { Hardfork, CANCUN } from 'tevm'

function validateMaxVersion(fork: BrandedHardfork) {
  if (!fork.lte(CANCUN)) {
    throw new Error(`Unsupported hardfork beyond Cancun: ${Hardfork.toString(fork)}`)
  }
}
```

### Range Validation

```typescript theme={null}
import { Hardfork, BERLIN, SHANGHAI } from 'tevm'

function isInSupportedRange(fork: BrandedHardfork): boolean {
  return fork.gte(BERLIN) && fork.lte(SHANGHAI)
}

// Check if fork is between Berlin and Shanghai (inclusive)
isInSupportedRange(LONDON)  // true
```

### Network Configuration

```typescript theme={null}
import { Hardfork, PRAGUE } from 'tevm'

function checkTestnetSupport(fork: BrandedHardfork) {
  if (fork.lte(PRAGUE)) {
    return "Fully supported"
  }
  return "Experimental - use with caution"
}
```

## Chronological Ordering

Uses chronological deployment order:

```
BERLIN (10) < LONDON (11) < MERGE (14) < SHANGHAI (15) < CANCUN (16)
```

## Comparison with isBefore

Unlike `isBefore`, `lte` returns true for equal versions:

```typescript theme={null}
import { LONDON } from 'tevm'

LONDON.lte(LONDON)       // true - equal counts
LONDON.isBefore(LONDON)  // false - strictly less than
```

## Performance

**Time Complexity:** O(1) - Array index comparison

**Typical Time:** \~10-20ns per call

## See Also

* [gte](/primitives/hardfork/gte) - Greater than or equal
* [lt](/primitives/hardfork/lt) - Strictly less than (alias for isBefore)
* [isBefore](/primitives/hardfork/is-before) - Strictly less than
