-
Notifications
You must be signed in to change notification settings - Fork 829
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
IBC transfer precompile #1459
IBC transfer precompile #1459
Conversation
@@ -0,0 +1,46 @@ | |||
[ |
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.
keeping formatted for readability for now (will flatten when code is post-draft)
} | ||
|
||
// RequiredGas returns the required bare minimum gas to execute the precompile. | ||
func (p Precompile) RequiredGas(input []byte) uint64 { |
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.
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.
Is IBC gas consumption pretty constant or can vary from call-to-call quite a bit? If the latter we can report gas consumption dynamically similar to https://github.com/sei-protocol/sei-chain/blob/seiv2/precompiles/wasmd/wasmd.go#L111-L135
precompiles/ibc/ibc.go
Outdated
return | ||
} | ||
func (p Precompile) transfer(ctx sdk.Context, method *abi.Method, args []interface{}) ([]byte, error) { | ||
pcommon.AssertArgsLength(args, 6) |
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.
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 see that from
is set an arg. Can anyone trigger an IBC transfer on anyone else's behalf? If not then we should be looking at caller
in https://github.com/sei-protocol/sei-chain/pull/1459/files#diff-3c39140061c990bd99f477fe4dbc73c0eaac283bfa477c1ba439016daf6fe688R87 to use as the from address 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.
Can reference https://github.com/sei-protocol/sei-chain/blob/seiv2/precompiles/bank/bank.go#L116 for example usage of caller
precompiles/ibc/ibc.go
Outdated
Amount: sdk.NewIntFromBigInt(amount), | ||
} | ||
|
||
height := clienttypes.Height{} |
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.
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.
will to defer to kartik here since it's IBC domain knowledge
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.
That's the timeout height, we can pass that in as a parameter in the transfer method and update the abi
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## evm #1459 +/- ##
==========================================
- Coverage 63.16% 62.84% -0.32%
==========================================
Files 350 351 +1
Lines 23760 23934 +174
==========================================
+ Hits 15008 15042 +34
- Misses 7896 8017 +121
- Partials 856 875 +19
|
precompiles/ibc/IBC.sol
Outdated
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
address constant BANK_PRECOMPILE_ADDRESS = 0x0000000000000000000000000000000000001008; |
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.
Could we udpate this to 0x0000000000000000000000000000000000001009 ? Oracle is about to be merged #1445
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.
Updated
Describe your changes and provide context
common/precompiles.go
Testing performed to validate your change