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

Why seiv2 GetSeiAddressOrDefault return evm bytes addresses? #481

Open
hea9549 opened this issue Apr 9, 2024 · 0 comments
Open

Why seiv2 GetSeiAddressOrDefault return evm bytes addresses? #481

hea9549 opened this issue Apr 9, 2024 · 0 comments

Comments

@hea9549
Copy link

hea9549 commented Apr 9, 2024

This is line 65 of keeper.go in the evm module of x.

func (k *Keeper) GetSeiAddressOrDefault(ctx sdk.Context, evmAddress common.Address) sdk.AccAddress {
	addr, ok := k.GetSeiAddress(ctx, evmAddress)
	if ok {
		return addr
	}
	return sdk.AccAddress(evmAddress[:])
}

GetSeiAddressOrDefault is a function that gets the sei address from the address of evm.
However, because it is not associated, return sdk.AccAddress(evmAddress[:]) in line 70 is activated when it is not stored in the kv store.
This puts the bytes of evmAddress into sdk.AccAddress.

Therefore, accAddress obtained based on publicKey and sdk.AccAddress made from bytes of evmAddress are different.

The sei address result of GetSeiAddressOrDefault before associate and the sei address result after associate are different.

How about returning zero address (0x000...) to indicate that it is not associate yet? Was the above situation intentional?

If it is a bug, I will upload a PR for the fix.

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

No branches or pull requests

1 participant