Skip to content
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

Transactions should be optimized #123

Closed
Tracked by #126
turbolent opened this issue Mar 3, 2024 · 3 comments · Fixed by #124
Closed
Tracked by #126

Transactions should be optimized #123

turbolent opened this issue Mar 3, 2024 · 3 comments · Fixed by #124

Comments

@turbolent
Copy link
Member

Issue To Be Solved

EVM transactions are currently submitted by wrapping them in a Cadence transaction.

The Cadence transaction sends the EVM transaction as a [UInt8] value, see

transaction(encodedTx: [UInt8]) {

The current encoding of such values in the current format, JSON, is very inefficient.

Suggest A Solution

Until we add support for the new, more efficient, Cadence value encoding format, CCF, it might be best to send the EVM transaction in a more efficient manner. For example, it could be sent as a hex-encoded string, then decoded in the transaction.

@m-Peter
Copy link
Collaborator

m-Peter commented Mar 3, 2024

That's a good point 👍 Thanks for the report 🙏
The change is rather straightforward to do, and in fact it might be easier to construct a cadence.String from the []byte data containing the RLP-encoded tx (see https://github.com/onflow/flow-evm-gateway/blob/main/services/requester/requester.go#L162)

@m-Peter m-Peter self-assigned this Mar 3, 2024
@turbolent
Copy link
Member Author

Note that Cadence Strings are required to be valid UTF-8, so it's not possible to use them for arbitrary byte arrays.

@m-Peter
Copy link
Collaborator

m-Peter commented Mar 3, 2024

The byte array will first pass through hex.EncodeToString(data) (where data is the byte array), and that string value will be used to construct a value of cadence.String.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants