README 1.3 KB

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