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

EVM documentation improvements #76

Merged
merged 7 commits into from
Apr 15, 2024
Merged

EVM documentation improvements #76

merged 7 commits into from
Apr 15, 2024

Conversation

dssei
Copy link
Contributor

@dssei dssei commented Apr 11, 2024

Adding rust docs for EVM related stucts/functions

@dssei dssei changed the title Doc improvements EVM documentation improvements Apr 11, 2024
@dssei dssei requested a review from codchen April 11, 2024 23:10
@dssei dssei marked this pull request as ready for review April 11, 2024 23:10
@dssei dssei requested a review from besated April 11, 2024 23:11
@dssei dssei self-assigned this Apr 11, 2024
@dssei
Copy link
Contributor Author

dssei commented Apr 11, 2024

@ARitz-Cracker please have a look.

@dssei dssei requested a review from codebycarson April 11, 2024 23:15
Copy link

@codebycarson codebycarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be useful to be explicit on what type of address each field takes (bech32 or 0x).

Looks good though!

/// Query to get hex payload for the ERC-20 `transfer` function
///
/// # Arguments
/// * `recipient` - Sei recipient address.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the cosmos or 0x address?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cosmos

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I guess through the docs I was referring to x0 addresses as EVM and to bech32 as Sei. But Sei is probably confusing as we support both.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In situations like these, it is better to be more verbose than not. Perhaps "bech32-encoded 'sei*' address" would be good.

Copy link

@ARitz-Cracker ARitz-Cracker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very much appreciated! Though I still wholly believe that more explicit language would benefit newcomers. Most of my comments can apply to other sections of this PR.

to: String,
/// Base64 encoded data to pass to the contract
data: String, // base64 encoded

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming that String is used instead Binary in all these cases in order to prevent needless parsing and re-encoding of the base64 data?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes all bytes will be transferred in base64 format

/// Query to get hex payload for the ERC-20 `transfer` function
///
/// # Arguments
/// * `recipient` - Sei recipient address.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In situations like these, it is better to be more verbose than not. Perhaps "bech32-encoded 'sei*' address" would be good.

@@ -41,13 +41,25 @@ pub enum SeiMsg {
SetMetadata {
metadata: Metadata,
},
/// Calls EVM contract deployed at `to` address with the given `data`.
/// The from address is the callers address.
/// Please note that the CW contract has to be in allow list in order to execute delegate call.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A link to further details regarding what this "allow list" is should be here as well as the helper function comments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it refers to any CW code hash in this list https://github.com/sei-protocol/sei-chain/blob/seiv2/x/evm/types/params.go#L142 (currently only the pointer contracts).

packages/sei-cosmwasm/src/msg.rs Outdated Show resolved Hide resolved
packages/sei-cosmwasm/src/msg.rs Outdated Show resolved Hide resolved
DelegateCallEvm {
/// The address of the EVM contract to call
to: String,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming this is hex-encoded, do these require the capitalization checksums?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it doesn't

/// Calls EVM contract deployed at `to` address with the given `data`.
/// The from address is the callers address.
/// Please note that the CW contract has to be in allow list in order to execute delegate call.
/// The EVM (Solidity) contract `msg.sender` in this case will be the callers address.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to link to the differences between how "sei*" and "0x*" addresses are trans-coded for humans vs contracts everywhere "the callers address" is mentioned.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@besated do you know if we already have a sei doc page for address mapping? If not I can help with writing up one (not sure where the gitbook repo is)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have this section in the docs - https://v2.docs.sei.io/setting-up-a-wallet#advanced

if you want to add more details, you can create a pr in the sei-docs repo

@dssei
Copy link
Contributor Author

dssei commented Apr 12, 2024

Very much appreciated! Though I still wholly believe that more explicit language would benefit newcomers. Most of my comments can apply to other sections of this PR.

@ARitz-Cracker thanks for reviewing. Will be addressing most comments shortly

@dssei
Copy link
Contributor Author

dssei commented Apr 15, 2024

@ARitz-Cracker addressed the most comments and will merge it. We can add more improvements in subsequent PRs

@dssei dssei merged commit aaca122 into main Apr 15, 2024
4 checks passed
@dssei dssei deleted the doc_improvements branch April 15, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants