Migrate from accounts/abi/bind to accounts/abi/bind/v2#10
Merged
Conversation
…ash was being pointlessly rehashed when added to the Merkle tree.
Coverage Report for CI Build 25532727102Coverage increased (+1.3%) to 11.636%Details
Uncovered Changes
Coverage Regressions54 previously-covered lines in 10 files lost coverage.
Coverage Stats
💛 - Coveralls |
Modver resultThis report was generated by Modver, This PR requires an increase in your module’s major version number. |
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.
Migrates the codebase from the deprecated
github.com/ethereum/go-ethereum/accounts/abi/bindpackage togithub.com/ethereum/go-ethereum/accounts/abi/bind/v2.Summary of changes
The v2 bind package uses a different code-generation model: instead of per-contract types with bound backends, the generated code provides pack/unpack helpers while
bind.BoundContract(created via.Instance(backend, addr)) serves as the runtime handle.Generated bindings (
contract/)erc20.goandtredd.gowithabigen --v2Taskfile.ymlto pass--v2to bothabigencommandsTreddABIstring variable is replaced byTreddMetaData.ABICore library (
tx.go)DeployTredd(opts, client, ...)→bind.DeployContract(opts, bytecode, client, constructorInput)NewTredd(addr, client)→treddABI.Instance(client, addr)returning*bind.BoundContractcon.Cancel(opts), etc.) →bind.Transact(con, opts, treddABI.PackCancel())con.MTokenType(callOpts)) →bind.Call(con, callOpts, treddABI.PackMTokenType(), treddABI.UnpackMTokenType)bind.WaitMined(ctx, client, tx)→bind.WaitMined(ctx, client, tx.Hash())ProposePayment,RevealKey,Cancel,ClaimRefundchanged from*contract.Treddto*bind.BoundContractTest harness (
testutil/harness.go)bind.NewKeyedTransactorWithChainID→bind.NewKeyedTransactor(v2 always requires a chain ID)accounts/abi/bind/backends.SimulatedBackend; added a localtestClientstruct that embeds*simulated.Backend(forCommit()) andsimulated.Client(forContractBackendmethods), preserving the behaviour thatwaitMineduses to auto-commit on the simulated chainContract tests (
contract_test.go)harness.Contract.Method(...)calls to usebind.Call/bind.Transactwith the generated pack/unpack helpersCommand (
cmd/tredd/)args.go: replacedbind.NewTransactor(keyReader, passphrase)(removed in v2) with explicit keystore decryption viaaccounts/keystore.DecryptKey+bind.NewKeyedTransactor(key.PrivateKey, chainID). ThechainIDis now a required parameter.client.goandserver.go: Ethereum client connection is established first so the chain ID can be fetched;handleKeyfilePassphraseis then called with the chain ID.WatchEvDecryptionKeyis replaced withbind.WatchEvents.queueClaimPaymentHelperparameter type updated from*contract.Treddto*bind.BoundContract.main.go:contract.TreddABI→contract.TreddMetaData.ABITry.md
No changes required: all user-facing CLI flags and the documented workflow are unchanged.