Skip to content

Conversation

@JonathanOppenheimer
Copy link
Member

@JonathanOppenheimer JonathanOppenheimer commented Sep 24, 2025

Why this should be merged

There are packages in subnet-evm and coreth that share a lot of functionality / are mirrored. As has been discussed as an evm team wide effort, we are working to uplift these packages to AvalancheGo to prevent the duplicative maintenance of two sets of the same code. This particular package, customlogs is a relatively easy lift.

Here are the packages being unified and uplifted:
coreth: https://github.com/ava-labs/coreth/tree/master/plugin/evm/customlogs
subnet-evm: https://github.com/ava-labs/subnet-evm/tree/master/plugin/evm/customlogs

How this was tested

This is currently 'dead' code; after a new AvalancheGo release is dropped, we can use the code in the evm repositories.

Need to be documented in RELEASES.md?

No

@JonathanOppenheimer JonathanOppenheimer self-assigned this Sep 24, 2025
@Copilot Copilot AI review requested due to automatic review settings September 24, 2025 20:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR uplifts the customlogs package from EVM repositories (subnet-evm and coreth) to AvalancheGo to eliminate duplicate maintenance. The package provides utility functions for working with Ethereum logs.

  • Adds a new customlogs package under vms/evm/
  • Introduces FlattenLogs utility function for converting nested log arrays

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

JonathanOppenheimer and others added 2 commits September 25, 2025 10:23
Co-authored-by: rodrigo <[email protected]>
Signed-off-by: Jonathan Oppenheimer <[email protected]>
@alarso16
Copy link
Contributor

Seems weird to uplift untested code, but it seems slightly silly to test this

@JonathanOppenheimer JonathanOppenheimer changed the title uplift: add customlogs package from evm repositories uplift customlogs` package from evm repositories Oct 23, 2025
@JonathanOppenheimer JonathanOppenheimer changed the title uplift customlogs` package from evm repositories uplift customlogs package from evm repositories Oct 23, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: _ext filename suffix doesn't make sense in the context of avalanchego anymore

import "github.com/ava-labs/libevm/core/types"

// FlattenLogs converts a nested array of logs to a single array of logs.
func FlattenLogs(list [][]*types.Log) []*types.Log {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the usage of this in core makes sense... but in filters we just use this to iterate over the logs and check if they match a filter (ref). We don't need to flatten the logs to do this... we could just iterate in 2-D. I feel like we could move this to core/blockchain.go pre-emptively instead and have it live as an unexported helper in that package where it is needed, and just update filters to just perform a 2-d iteration over the logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants