-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
I have a precompile that moves funds from users to "system" accounts used as escrow.
The addresses generated for these escrow accounts are made like this:
func (k *Keychain) AccAddress() sdk.AccAddress {
bz := make([]byte, 8)
binary.BigEndian.PutUint64(bz, k.Id)
addr := append([]byte("keychain-"), bz...)
return addr
}
For example, they look like this: warden1ddjhjcmgv95kutgqqqqqqqqqqqqs5sgg2s
The newly introduced call to AfterBalanceChange(...)
for the precompile revert logic, tries to parse all addresses that sent or received tokens as 20-bytes long byte arrays here:
evm/precompiles/common/balance_handler.go
Line 87 in af6f8d4
return common.Address(accAddr.Bytes()), nil |
This lead to a panic in my particular use case:
runtime error: cannot convert slice with length 17 to array or pointer to array with length 20
My question is:
- should I change my logic? Is it a bad practice to have these custom addresses and working with the EVM?
- or, is there a way to fix
AfterBalanceChange
?
Cosmos EVM Version
main
How to reproduce?
No response