-
Notifications
You must be signed in to change notification settings - Fork 238
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
Problem: no stateful precompiled contract for relayer #1014
Conversation
75631b9
to
bd7ae10
Compare
I guess this PR is to be able to test the ibc middleware that will convert cosmos msgs to ethermint msgs? would it be possible to write an ADR for the design? @yihuang |
I guess this PR itself is just try go-relayer in integration test, so it'll be more convenient for @mmsqe to further experiment using the golang relayer |
yes I understand that this PR is only to integrate with the go-relayer but I just using this opportunity to raise the need for an ADR before we are getting too deep in the implementation so that we can have a better visibility on what has to be done |
Ideally the IBC protocol is relayer agnostic so using hermes or gorelayer implementation should not matter unless we change the semantic for cronos which may raise some concerns (which could be discussed in the ADR) |
@mmsqe need to patch the relayer to let it send evm tx instead of cosmos tx. |
sorry that I am not so familiar with rust. |
Could it be done without changing the relayer implementation? something like Relayer send cosmos txs -> Cronos middleware catch the cosmos txs and wrap it to an evm txs using module private key in a general way, if the concern is to generate the receipt for cosmos txs, I think execution is not needed but we could refactor ethermint (https://github.com/evmos/ethermint/blob/main/x/evm/keeper/msg_server.go#L92) to be able to generate more easily receipts out of an eth txs |
can you elaborate? by middleware do you mean a rpc service? it can convert the original tx to an evm tx, but can't re-sign the evm tx using the relayer's key, right? But we might can develop a standalone convert and resign cli, which can runs together with relayer and access the same keystore, so we don't have to modify rust and golang version twice. but still need to make some changes to the relayer.
there are many things to emulate: tx list in |
I mean ibc middleware, or it can even be done in the ante handler if we want to generalise to all cosmos txs Yes, the evm txs will be signed by an arbitrary key (module key in genesis config) not the relayer key
I think we can wrap the cosmos txs in the evm txs like putting the cosmos txs encoded in the call data But in some case, we may need to also have the ability to generate "custom" ethereum events which make a bit complex. |
do you mean broadcast a new tx in the ibc middleware? that is part of the state machine. |
One step is to refactor ethermint to make it easier to generate ethereum receipt. I understand that it is a bit complicated now because its all across many different place. But from my understanding the ethereum receipt information is stored in the cosmos events in many places and reconstructed in the rpc endpoints. It may be possible to refactor the code to have an utility function to generate receipt. but maybe there is more complexity (?), I havent look too deep into the code |
even if we emulated the events, there are still some difficulties, for example |
another possible flow is cosmos tx -> middleware convert to eth tx signed with module private key -> execute the eth tx as a specific precompile (we may be able to bypass signature verification check and set direction From to original cosmos sender) at the end we can get the correct tx result code and gas used in the receipt. but not sure if its possible to change to bypass the signature verification without any risks? |
I guess ibc incentivization feature rely on correct signer of the tx. |
0ed2e95
to
7fe73e8
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1014 +/- ##
==========================================
+ Coverage 46.60% 48.42% +1.82%
==========================================
Files 105 73 -32
Lines 7884 6125 -1759
==========================================
- Hits 3674 2966 -708
+ Misses 3843 2846 -997
+ Partials 367 313 -54 |
1d77749
to
49c2810
Compare
if len(contract.Input) < int(prefixSize4Bytes) { | ||
return nil, errors.New("data too short to contain prefix") | ||
} | ||
prefix := int(binary.LittleEndian.Uint32(contract.Input[:prefixSize4Bytes])) |
Check failure
Code scanning / gosec
Potential integer overflow by integer type conversion Error
050408c
to
a70ce2e
Compare
without convert event
for k, v := range keys { | ||
allKeys[k] = v | ||
} |
Check warning
Code scanning / CodeQL
Iteration over map Warning
for k, v := range tkeys { | ||
allKeys[k] = v | ||
} |
Check warning
Code scanning / CodeQL
Iteration over map Warning
for k, v := range memKeys { | ||
allKeys[k] = v | ||
} |
Check warning
Code scanning / CodeQL
Iteration over map Warning
Signed-off-by: mmsqe <[email protected]>
Signed-off-by: yihuang <[email protected]>
1f215fb
Updates: cosmos/relayer#1187
👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻
PR Checklist:
make
)make test
)go fmt
)golangci-lint run
)go list -json -m all | nancy sleuth
)Thank you for your code, it's appreciated! :)