# Overview
agave-xdp-ebpf is the eBPF XDP program loaded by Agave.
It's a lib AND bin package, where the bin package is used to build the eBPF
bytecode, and the lib package is used to bundle the eBPF bytecode in a host
crate and loaded as a regular dependency.
# Usage
To use the program you can depend on the `agave-xdp-ebpf` crate and load the
bytecode available at `agave_xdp_ebpf::AGAVE_XDP_EBPF_PROGRAM` using
`aya::Ebpf::load`.
# Building the eBPF XDP program
The eBPF program is prebuilt and saved in `./agave-xdp-prog`. This is done so
that the crate can be built from crates.io. To rebuild the program from the
monorepo root run:
scripts/build-agave-xdp-ebpf.sh
The ebpf program must be rebuilt anytime the source changes (duh), or the
rust nightly version used by the monorepo is bumped.
# Verify the crates.io bytecode
To verify that the bytecode loaded by agave via crates.io matches the bytecode
generated by the source included in this package, from the monorepo root run:
# This will rebuild and print whether the hashes have changed. If you haven't made any
# modications, the hashes must match.
scripts/build-agave-xdp.sh
# If the hashes match, build agave as usual and verify that the final code also matches
scripts/elf-hash-symbol.sh target/release/agave-validator AGAVE_XDP_EBPF_PROGRAM