feat: staking precompile delegation and stakingpool queries#1356
feat: staking precompile delegation and stakingpool queries#1356kyriediculous wants to merge 4 commits intosei-protocol:evmfrom
Conversation
|
@kyriediculous this looks great, do you mind merging? |
|
@philipsu522 I'm actually working on implementing a more final specification. See this hackMD doc https://hackmd.io/EcPRzGcPR8OuAxr-48wkRA My only hurdle at the moment is that the current cosmos-sdk version used by Sei doesn't have the latest protocol buffer messages for staking. So I'll have to use a later version, but this shouldn't be a breaking change. E.g. the version used in Sei doesn't have all these fields yet in the protobufs: https://github.com/cosmos/cosmos-sdk/blob/a79f932ecf8ef562928fa72989e53ae22e251d7f/proto/cosmos/staking/v1beta1/staking.proto#L239 Hoping to maybe do it this weekend finally ! I didn't have much time last weekend. |
|
I added some more undelegation precompiles and the PR is now feature ready for us at Tenderize. Happy to add a few more generic functions too (e.g. to fetch Validator). One caveat is that we did have to upgrade |
go.mod
Outdated
| github.com/armon/go-metrics v0.4.1 | ||
| github.com/btcsuite/btcd v0.22.1 | ||
| github.com/cosmos/cosmos-sdk v0.45.10 | ||
| github.com/cosmos/cosmos-sdk v0.47.10 |
There was a problem hiding this comment.
Should be reversed since we actually meant to upgrade sei-cosmos, not cosmos-sdk
hey @kyriediculous awesome, looks good. One nit thing, for sei-protocol/sei-cosmos@evm...kyriediculous:sei-cosmos:evm our base branch is actually seiv2 - do you think you can rebase your changes (or cherry-pick) on that? we can then get it in. |
Thanks ! will do. One change we made is change the return types from Messages from Do these functions properly throw a Or is this why there was a |
| pcommon.AssertArgsLength(args, 2) | ||
| delegator := p.evmKeeper.GetSeiAddressOrDefault(ctx, caller) | ||
| validatorBech32 := args[0].(string) | ||
| validatorBech32 := p.evmKeeper.GetSeiAddressOrDefault(ctx, args[0].(common.Address)).String() |
There was a problem hiding this comment.
validator address is different from normal account address and doesn't have associated EVM address, so we can't change this line
There was a problem hiding this comment.
What's the length of these ?
I changed these do address mainly because they were previously string which in solidity is really a dynamic bytes array.
So if the validator addresses are 32 Bytes or shorter we can use a normal value type like bytes32.
| delegator := p.evmKeeper.GetSeiAddressOrDefault(ctx, caller) | ||
| srcValidatorBech32 := args[0].(string) | ||
| dstValidatorBech32 := args[1].(string) | ||
| srcValidatorBech32 := p.evmKeeper.GetSeiAddressOrDefault(ctx, args[0].(common.Address)).String() |
|
Hi @codchen @philipsu522 @Kbhat1 @kyriediculous , I want to know if there is plan to integrate this? As I am working on liquid staking on Sei EVM this would be a lot of help. If this is integrated into next releases that would be helpful too. |
Yes we'd still love to :) |
Describe your changes and provide context
Testing performed to validate your change