Skip to content

chore: Add abigen V2 bindings#561

Closed
janjakubnanista wants to merge 2 commits intooptimismfrom
jan/abigen-v2-bindings
Closed

chore: Add abigen V2 bindings#561
janjakubnanista wants to merge 2 commits intooptimismfrom
jan/abigen-v2-bindings

Conversation

@janjakubnanista
Copy link
Copy Markdown

@janjakubnanista janjakubnanista commented Mar 26, 2025

Description

Recently released abigen V2 is a major improvement over the previous version. It would simplify e.g. op-deployer development workflow greatly.

Although abigen@1.15.6 binary can be installed just fine (using any distribution channel), the generated code relies on the associated code to be present in the github.com/ethereum/go-ethereum package:

// Excerpt from the generated code
import (
	"bytes"
	"errors"
	"math/big"

	"github.com/ethereum/go-ethereum/accounts/abi"
	"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" // <------ THE PROBLEM
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/core/types"
)

Since we replace github.com/ethereum/go-ethereum with github.com/ethereum-optimism/op-geth, this code is all red and squiggly.

To fix this, this PR adds additive changes from the original PR, basically:

git remote add upstream https://github.com/ethereum/go-ethereum.git
git fetch upstream
git restore --worktree --source upstream/master accounts/abi
git restore --worktree --source upstream/master cmd/abigen

The only manual changes needed were:

  • flags.CheckExclusive(c, abiFlag, jsonFlag) -> utils.CheckExclusive(c, abiFlag, jsonFlag) in abigen/main.go (this commit)

@janjakubnanista janjakubnanista requested a review from a team as a code owner March 26, 2025 03:54
@janjakubnanista janjakubnanista requested a review from geoknee March 26, 2025 03:54
@ajsutton
Copy link
Copy Markdown
Contributor

I'd suggest it would be better to pull through the whole upstream release rather than cherry-picking. Otherwise we'll have a lot of conflicts to work through when we do pull through the release. We've waiting nearly 2 years for abigen v2, a little longer won't kill us. :)

@janjakubnanista
Copy link
Copy Markdown
Author

@ajsutton okay then 😞 will try to be patient

@tynes
Copy link
Copy Markdown
Contributor

tynes commented Jun 3, 2025

We should be able to close this now

@tynes tynes closed this Jun 3, 2025
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