refactor(runtime): remove dead native stake/ALT implementations #1641
@yewman could't configure pht for this updated map, it was failing if I kept using pht for this. Any suggestion on this?
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
<details><summary> :rocket: New features to boost your workflow: </summary>
</details>
This can be removed
we don't need comments to refer to the old implementation.
this can be removed
Requested changes.
A few missed opportunities for dead-code removal.
Stake (shared/runtime/program/stake/state.zig):
Meta.setLockup (L36-58) — reachable only from the deleted executor; drops last instruction.LockupArgs use inside state.zig.Stake.split (L66-82) — dangling program.StakeError ref, no external callers.Stake.deactivate (L85-90) — dangling program.StakeError return type, no external callers.Authorized.authorize (L138-178) + Authorized.check (L120-134) — third program.StakeError site; check only called by authorize.Authorized.equals (L180-183) and Lockup.equals (L208-212) — zero callers (all .equals( hits elsewhere are Pubkey.equals).StakeFlags.combine (L109-111) — zero callers (StakeFlags.EMPTY stays, used by parse_stake.zig).const instruction = @import("instruction.zig") at state.zig:L10 becomes unused and can go, and all three dangling program.StakeError references disappear without needing to add back a StakeError stub.ALT (shared/runtime/program/address_lookup_table/):
pub const program = @import("lib.zig") (lib.zig:L10) — bogus self-import, zero refs (same shape as the pub const state = @import("stake/lib.zig") this PR already removed from program/lib.zig).pub const instruction = @import("instruction.zig") (lib.zig:L12) — module alias, zero refs; Instruction is already re-exported directly on L14. (The parallel pub const state = @import("state.zig") at L11 must stay — live via address_lookup_table.state.LOOKUP_TABLE_META_SIZE.)pub const COMPUTE_UNITS = 750 (lib.zig:L24) — zero internal or external refs; parallel to the SOURCE_IDs this PR did remove.LookupTableMeta.new (state.zig:L60-64) — zero callers; LookupTableMeta is always built via struct-literal init.AccountIndex scaffolding in instruction.zig — private AccountIndexWithPayer/AccountIndexNoPayer enums (L52-61) and the five pub const AccountIndex = ... decls on the variant structs (L76, L80, L87, L91, L95). The variant structs themselves stay (bincode payloads), but .AccountIndex on them is never referenced anywhere post-executor.Also worth updating the PR body — it still says "Replace PHT with linear scan for NATIVE", but the final commit (applied pht fix from Harold) kept the PHT and instead swapped in a SplitMix64 finalizer.
We should remove these empty structs, no need for the instruction variants to carry an named empty struct
We should remove the empty structs. Additionally I think the address_lookup_table, and stake modules could be defined just within a lib.zig similar to the config program. Ultimately I think we should separate the native program interfaces from their validator implementations however that can be left for a follow up PR.
https://github.com/Syndica/sig/pull/1641/commits/85b0250df934e367ccfd540cd3918bf710f3f323
Merged into one file(s)
Approved these changes.
Approved these changes.
yewman
hamza-syndica
Closes #1627 (PR 1)
Removes ~4800 lines of dead code after hardcoding the core-BPF migrations in #1618.