Skip to content

Why seiv2 GetSeiAddressOrDefault return evm bytes addresses? #481

@hea9549

Description

@hea9549

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions