-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MaintainerProxy bindings #3630
Merged
Merged
MaintainerProxy bindings #3630
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Empty file.
2,383 changes: 2,383 additions & 0 deletions
2,383
pkg/chain/ethereum/tbtc/gen/abi/MaintainerProxy.go
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we need this piece. Can you elaborate, please?
Contract bindings are generated based on the ABI. If we fixed the ABI in
after_abi_hook
, why the additional work?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was about to ask the same question 😀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I comment this function and run
make mainnet
, I'm getting compilation errors like this:It seems the generated contract bindings still contain the wrong type (
BitcoinTxUTXO
instead ofBitcoinTxUTXO2
):There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
after_abi_hook
we change*.go
files.It seems the contract bindings are generated based on
*.abi
files.The
$<
argument in this invocation means the first prerequisite will be used:which will be
MaintainerProxy.abi
and notMaintainerProxy.go
.Therefore, we either leave the code as is or we remove it and change
MaintainerProxy.abi
instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me re-check my understanding of the issue.
after_abi_hook
renames structures that were incorrectly re-declared in the same Go package given this bug: ethereum/go-ethereum#24627.This is the version on
main
:keep-core/pkg/chain/ethereum/tbtc/gen/Makefile
Lines 24 to 26 in 78da87c
My understanding of the bug, is that both the generated
tbtc/gen/abi/Bridge.go
andtbtc/gen/abi/WalletCoordinator.go
declaresBitcoinTxInfo
struct. To make the Go compiler happy, we renameBitcoinTxInfo
toBitcoinTxInfo2
intbtc/gen/abi/WalletCoordinator.go
.Those two Go files are generated with
@go run github.com/ethereum/go-ethereum/cmd/abigen
.Now, we add another contract that also uses
BitcoinTx.Info
in Solidity so it will haveBitcoinTxInfo
re-declared in the Go code given the issue from ethereum/go-ethereum#24627. We do the same trick as inmain
. We extend theafter_abi_hook
and do some renames:keep-core/pkg/chain/ethereum/tbtc/gen/Makefile
Lines 26 to 33 in 36c0c90
This makes sense to me up to this point.
But this is not enough! If we try to build the project, we will encounter errors like:
Looking at the generated code at the problematic line:
mp.contract.NotifyFundsBelowDust
is declared in thetbtc/gen/abi/MaintainerProxy.go
and expectsBitcoinTxUTXO2
.arg_mainUtxo
fromMaintainerProxy.go
has an incorrect type though:arg_mainUtxo abi.BitcoinTxUTXO,
OK, that makes sense. Just like
tbtc/gen/abi/MaintainerProxy.go
this file is generated based ontbtc/gen/abi/MaintainerProxy.abi
and in the*.abi
file we don't have the rename.In other words, the
after_contract_hook
is partially a result of ethereum/go-ethereum#24627 and partially how our Go contract bindings work. The fix from ethereum/go-ethereum#24924 will change the generatedtbtc/gen/abi/*.go
files but we'll have to adjust the@go run github.com/keep-network/keep-common/tools/generators/ethereum
logic to follow the same naming rules as the*.abi
file will remain unchanged.Does it make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pdyraga Yes, it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomaszslabon Can you please add a comment to
after_contract_hook
referencing keep-network/keep-common#117 ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 800fdda.