feat: RomeEvents.sol library + Hardhat integration for structured events#27
Open
skansal-rome wants to merge 4 commits into
Open
feat: RomeEvents.sol library + Hardhat integration for structured events#27skansal-rome wants to merge 4 commits into
skansal-rome wants to merge 4 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Solidity-side of the Structured Event PDA Standard. Contracts call
RomeEvents.emitEvent(topic0, topics, data), which wraps the new Rome EVM precompile at0xFF…09. The library fires a standard EVMLOGalongside the ring-PDA write, so ethers.js / Blockscout /eth_getLogsstay compatible.contracts/events/RomeEvents.sol— library withemitEvent,initRing,ringHeaderhelpers. Follows repo conventions (solc 0.8.28, precompile constant address, LE helpers matchingConvert).contracts/events/test/EventEmitter.sol— minimal test contract that fires aTransfer(from, to, value)event through the library.tests/event-pda.integration.ts— Hardhat integration tests (skipped unlessRUN_EVENT_PDA_INTEGRATION=1 + SOLANA_RPC_URL + ROME_EVM_PROGRAM_ID + ROME_CHAIN_IDare 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 mirroringrome-sdk/rome-solana/src/events/layout.rs.@solana/web3.jsis imported dynamically so the defaultnpx hardhat testrun (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 testwithout env flag —2 skipped (2 nodejs), no failures, no imports for@solana/web3.js.RUN_EVENT_PDA_INTEGRATION=1 … npx hardhat test … --network localagainst 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.jsat merge time; reader-side verification is already covered by the rome-sdk integration test.Depends on
Related
🤖 This response was generated by Claude Code.