Skip to content

feat: RomeEvents.sol library + Hardhat integration for structured events#27

Open
skansal-rome wants to merge 4 commits into
masterfrom
feat-event-pda-standard
Open

feat: RomeEvents.sol library + Hardhat integration for structured events#27
skansal-rome wants to merge 4 commits into
masterfrom
feat-event-pda-standard

Conversation

@skansal-rome
Copy link
Copy Markdown
Contributor

Summary

Solidity-side of the Structured Event PDA Standard. Contracts call RomeEvents.emitEvent(topic0, topics, data), which wraps the new Rome EVM precompile at 0xFF…09. The library fires a standard EVM LOG alongside the ring-PDA write, so ethers.js / Blockscout / eth_getLogs stay compatible.

  • contracts/events/RomeEvents.sol — library with emitEvent, initRing, ringHeader helpers. Follows repo conventions (solc 0.8.28, precompile constant address, LE helpers matching Convert).
  • contracts/events/test/EventEmitter.sol — minimal test contract that fires a Transfer(from, to, value) event through the library.
  • tests/event-pda.integration.ts — Hardhat integration tests (skipped unless RUN_EVENT_PDA_INTEGRATION=1 + SOLANA_RPC_URL + ROME_EVM_PROGRAM_ID + ROME_CHAIN_ID are set). Pins explicit 1 gwei gas price and a dummy recipient since local Rome chains ship with a single funded signer.
  • tests/helpers/eventRing.ts + tests/helpers/solana.ts — pure TS byte-layout + PDA-seed helpers mirroring rome-sdk/rome-solana/src/events/layout.rs. @solana/web3.js is imported dynamically so the default npx hardhat test run (without the env flag) does not require the Solana SDK.

Test plan

  • npx hardhat compile — clean (Compiled 1 Solidity file with solc 0.8.28).
  • npx hardhat test without env flag — 2 skipped (2 nodejs), no failures, no imports for @solana/web3.js.
  • RUN_EVENT_PDA_INTEGRATION=1 … npx hardhat test … --network local against a locally-running Rome stack with the rome-evm-private PR deployed: Test 1 passes — native Transfer LOG present in receipt. Test 2 gated on installing @solana/web3.js at merge time; reader-side verification is already covered by the rome-sdk integration test.

Depends on

Related

🤖 This response was generated by Claude Code.

Sattvik Kansal and others added 4 commits April 16, 2026 20:26
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds EventEmitter.sol test contract, event-pda.integration.ts, and two
helper modules (eventRing.ts byte-layout parser, solana.ts lazy env
reader). All tests skip unless RUN_EVENT_PDA_INTEGRATION=1 — npx hardhat
compile and npx hardhat test pass without a local Rome stack.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add @ts-ignore before dynamic imports of @solana/web3.js (integration-only dep, not in package.json)
- Remove pointless truthy-check ternary on encodeAbiParameters (always-true function reference)
- Remove unused imports (before, parseAbiParameters, hexToBytes)

Hardhat compile + test both clean; integration tests skip correctly without env var.
…integration

- Local Rome chain rejects viem's default gas price on legacy txs; pin 1 gwei.
- Local Rome chain only has one funded signer; use a stable dummy address
  (0x…dEaD) as the transfer recipient instead of a second wallet client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant