-
Notifications
You must be signed in to change notification settings - Fork 84
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
refactor: Discuss with core team the signature of eth_send_transaction #276
Comments
I am in favor of number 1, For number 2 a malicious user could directly send a transaction to Kakarot and have a decoded payload struct different from the tx hash info. (Maybe users cannot interact directly with Kakarot Contract if not the RPC, but I think its to big of a risk) |
number 2 in this form is really naive. A serious number 2 would make the RPC signs their transaction, and fraud proof would squash a stake (not to say I'm in favor, but to say that 2 like that is ofc out of question) |
Interesting idea if we want one day to do a L3 or L4 with very low fees and fast TPS but accountable sequencer |
I feel option 3 might be more efficient than option 1. As encoding from the struct, would mean converting felts -> byte arrays, which need bit shift or division. and for decoding to a struct, is converting bytes array -> felts, which is mostly multiplication and addition. For cairo0 code, we are reusing the bytes_arrays generated to encode before verifying transactions, but if we have to encode the struct, we would need more operations similar to "encode_felt" and then later append them together with a function similar to "encode_list" |
Important update: we are gathering some bugs in the Kakarot v0 codebase, we need to make sure each issue and each PR in Kakarot-ssj is aware of the lists of known bugs. Look at this tracking issue everytime you take an issue and check your issue isn't targeted by a known bug. Will add this reminder in many places to make sure we keep track of known bugs. |
LGTM @danilowhk |
Currently, in Kakarot Cairo0, for
eth_send_transaction
(entrypoint called duringeth_sendRawTransaction
via EOA) we use RLP::Decode and RLP::Encode functions. Why?Current behaviour: https://github.com/kkrt-labs/kakarot/blob/c04cb72f040e059dfa3a8dc4ca24c6a68083409b/src/utils/eth_transaction.cairo#L28
Current Flow
Then EOA is able to perform
eth_verify_signature
using r, s, v and the tx hash derived from the raw tx payload. This is very costly in gas, but safe.Alternative number 1
By using this workaround, we can perform off-chain the RLP decode without hindering security.
Alternative number 2: (not recommended ❌)
Alternative number 3: (unclear about gas) (Recommended ✅)
Recommendation:
I recommend number 3 alternative
The text was updated successfully, but these errors were encountered: