Conversation
When multiple entities are defined in the same #[hyperstack] module, the macro system was collecting all PDA registrations from ALL entities and passing them to EVERY entity. This caused entities to receive instruction hooks for instructions they didn't reference. Example: In the metaplex stack, Collection was getting hooks for CreateMetadataAccountV3 (which only NFTMetadata should have), causing CreateMetadataAccountV3 instructions to be incorrectly routed to the Collection entity at runtime. Fix: Collect PDA registrations per-entity using a new function collect_pda_registrations_per_entity() that returns a HashMap keyed by entity name. Each entity now only receives its own PDA registrations. Closes: metaplex CreateMetadataAccountV3 routing to wrong entity
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds CPI event support end-to-end (IDL codegen → instruction parser → VM routing → TypeScript output), fixes cross-entity instruction hook contamination, and improves observability throughout the Vixen runtime flush path. It also adds packed-struct support and large-array serde helpers to the IDL code generator. Key changes:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant RPC as Yellowstone gRPC
participant VH as VmHandler (vixen_runtime)
participant IP as InstructionParser (idl_parser_gen)
participant VM as VmContext (vm.rs)
participant TS as TypeScriptCompiler
RPC->>VH: raw transaction instruction bytes
VH->>IP: parser.unpack(data)
note over IP: Match 16-byte prefix<br/>[anchor_tag(8) + event_disc(8)]
IP-->>VH: Ok(Enum::Event_Swap(SwapEvent))
VH->>VH: event_type = "program::SwapCpiEvent"
VH->>VM: process_event(bytecode, event_value, "SwapCpiEvent", context)
alt PDA lookup miss
VM->>VM: queue_account_update(state_id, QueuedAccountUpdate{write_version})
note over VM: CpiEvent treated same as IxState<br/>for pending-update flush trigger
else PDA found
VM->>VM: execute_handler → mutations
VM->>VM: flush_pending_updates(lookup_keys)
loop pending updates
VM->>VM: execute_handler(pending) → more mutations
end
end
VM-->>VH: all_mutations
note over TS: compile_stack_spec (multi-entity)
loop each entity
TS->>TS: extract_builtin_resolver_type_names(spec)
TS->>TS: compile with already_emitted_types
TS->>TS: extract_emitted_enum_type_names(output)
TS->>TS: emitted_types.extend(enum_names + builtin_names)
end
|
Add missing imports for UrlSource and UrlTemplatePart from crate::ast. Fix variable name from url_val to url_path in URL resolver config.
Prefix url_path with underscore to fix clippy -D warnings error
The hyperstack macro requires events to have matching type definitions in the IDL `types` array to generate event struct code. Added type definitions for ResetEvent, BuryEvent, DeployEvent, and LiqEvent to fix the "has no matching type definition" compilation error.
- Remove unused `hooks_count` variable in vixen_runtime.rs - Remove redundant `is_cpi_event_for_type` shadowing in writer.rs - Add discriminator validation to `try_from_bytes` in idl_codegen.rs
extract_emitted_enum_type_names only recognised z.enum patterns but zero-variant enums are emitted as z.string(). Extend pattern matching to detect both forms and prevent duplicate identifier errors.
Eliminate duplicate (source_field_name, is_whole_source) logic blocks from entity.rs and sections.rs by extracting into a shared helper function in stream_spec/mod.rs.
Add doc comment explaining that is_large_array only inspects the outermost array dimension and nested arrays are not examined.
feat: misc compiler, VM, and IDL improvements
Summary
This PR contains various improvements to the compiler, VM, macros, and IDL systems:
Compiler & VM (interpreter)
Macros
IDL
IdlReprChore
Changes