Skip to content

Conversation

@amateima
Copy link
Contributor

@amateima amateima commented Oct 15, 2025

This PR introduces a new AcrossEventEmitter contract that provides a dedicated mechanism for emitting on-chain metadata events.

Changes

AcrossEventEmitter is a simple contract for emitting arbitrary bytes-encoded metadata as on-chain events. The usecase behind this contract is to emit metadata without modifying Across core contracts. This will allow the indexer to enrich Across protocol data with additional info that cannot be grabbed easily from onchain events (e.g swaps performed as destination actions)

Signed-off-by: amateima <amatei@umaproject.org>
Signed-off-by: amateima <amatei@umaproject.org>
@amateima amateima force-pushed the amatei/metadata-event-emitter-contract branch from 8f36a7a to f88ed47 Compare October 15, 2025 23:44
Copy link
Contributor

@mrice32 mrice32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two quick comments!

Comment on lines 17 to 29
/**
* @notice Prevents native token from being sent to this contract
*/
receive() external payable {
revert("Contract does not accept native token");
}

/**
* @notice Prevents native token from being sent to this contract via fallback
*/
fallback() external payable {
revert("Contract doesn't accept native token");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: why implement these functions at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered would be good practice to not allow funds being sent by mistake, but I can remove this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't implement them, they'll revert when users try to call them, so it would be the same outcome.

Comment on lines 36 to 37
require(data.length > 0, "Data cannot be empty");
require(data.length <= 2048, "Data too large");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why limit the size of the data?

Would this protect us from anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the upper limit here, but I'd keep the > 0 validation, so that the indexer would not index events with no metadata at all

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

Signed-off-by: amateima <amatei@umaproject.org>
@amateima amateima force-pushed the amatei/metadata-event-emitter-contract branch from e934edd to c7c0175 Compare October 20, 2025 20:59
@amateima amateima requested a review from mrice32 October 20, 2025 21:00
@amateima amateima marked this pull request as ready for review October 20, 2025 21:00
* @notice Emits metadata as an event
* @param data The bytes data to emit
*/
function emitData(bytes calldata data) external nonReentrant {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-entrancy guards are generally best practice, but you don't need them if your contract isn't making any external calls (which is the case in this contract).

I would suggest removing to save a little gas.

Signed-off-by: amateima <amatei@umaproject.org>
@amateima amateima requested a review from mrice32 October 21, 2025 15:29
@amateima amateima merged commit 1bf8746 into master Oct 22, 2025
9 of 10 checks passed
@amateima amateima deleted the amatei/metadata-event-emitter-contract branch October 22, 2025 22:33
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.

3 participants