From bb2cd8927211109d225800663ef21ce04c0e1b70 Mon Sep 17 00:00:00 2001 From: Itzhak Bokris Date: Sun, 22 Sep 2024 11:17:32 +0300 Subject: [PATCH] feat: Register incentives and sponsorship amino message to support eip712 (#1240) --- scripts/incentives/lockup_bootstrap.sh | 8 ++++---- scripts/pools/e2e.sh | 12 ++++++------ x/incentives/types/codec.go | 11 +++++++++++ x/sponsorship/types/codec.go | 13 +++++++++++++ 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/scripts/incentives/lockup_bootstrap.sh b/scripts/incentives/lockup_bootstrap.sh index cc7651070..c26cd9f56 100644 --- a/scripts/incentives/lockup_bootstrap.sh +++ b/scripts/incentives/lockup_bootstrap.sh @@ -1,16 +1,16 @@ #!/bin/sh echo "locking LP1 tokens for 2 weeks" -dymd tx lockup lock-tokens 50000000000000000000gamm/pool/1 --duration="60s" --from pools --keyring-backend=test -b block -y --gas-prices 100000000adym +dymd tx lockup lock-tokens 50000000000000000000gamm/pool/1 --duration="60s" --from pools --keyring-backend=test -b sync -y --gas-prices 100000000adym sleep 7 echo "locking uatom tokens for 1h" -dymd tx lockup lock-tokens 500000000uatom --duration="3600s" --from user --keyring-backend=test -b block -y --gas-prices 100000000adym +dymd tx lockup lock-tokens 500000000uatom --duration="3600s" --from user --keyring-backend=test -b sync -y --gas-prices 100000000adym sleep 7 echo "locking dym tokens for 1 day" -dymd tx lockup lock-tokens 100dym --duration="24h" --from user --keyring-backend=test -b block -y --gas-prices 100000000adym +dymd tx lockup lock-tokens 100dym --duration="24h" --from user --keyring-backend=test -b sync -y --gas-prices 100000000adym sleep 7 echo "unlocking dym tokens" -dymd tx lockup begin-unlock-by-id 2 --from user --keyring-backend=test -b block -y --gas-prices 100000000adym +dymd tx lockup begin-unlock-by-id 2 --from user --keyring-backend=test -b sync -y --gas-prices 100000000adym diff --git a/scripts/pools/e2e.sh b/scripts/pools/e2e.sh index 4bf0e0c6c..130ca91c8 100644 --- a/scripts/pools/e2e.sh +++ b/scripts/pools/e2e.sh @@ -1,7 +1,7 @@ #!/bin/bash create_asset_pool() { - dymd tx gamm create-pool --pool-file=$1 --from pools --keyring-backend=test -b block --gas auto --yes --fees 1dym + dymd tx gamm create-pool --pool-file=$1 --from pools --keyring-backend=test -b sync --gas auto --yes --fees 1dym } # create pools and pool gauges @@ -16,20 +16,20 @@ create_asset_pool "$(dirname "$0")/nativeDenomPoolB.json" echo "=====================" streamer_addr=$(dymd q auth module-account streamer -o json | jq '.account.base_account.address' | tr -d '"') echo "Sending 300000dym to $streamer_addr" -dymd tx bank send hub-user $streamer_addr 300000dym --keyring-backend test -b block -y --fees 1dym +dymd tx bank send hub-user $streamer_addr 300000dym --keyring-backend test -b sync -y --fees 1dym # lock LP tokens echo "=====================" echo "Locking LP tokens" echo "locking LP1 tokens for 1 day" -dymd tx lockup lock-tokens 50000000000000000000gamm/pool/1 --duration="24h" --from pools --keyring-backend=test -b block -y --fees 1dym +dymd tx lockup lock-tokens 50000000000000000000gamm/pool/1 --duration="24h" --from pools --keyring-backend=test -b sync -y --fees 1dym echo "locking LP2 tokens for 1 minute" -dymd tx lockup lock-tokens 50000000000000000000gamm/pool/2 --duration="1m" --from pools --keyring-backend=test -b block -y --fees 1dym +dymd tx lockup lock-tokens 50000000000000000000gamm/pool/2 --duration="1m" --from pools --keyring-backend=test -b sync -y --fees 1dym # create new stream echo "=====================" echo "Gov proposal for creating new stream with LP1 and LP2 as incentives targets" -dymd tx gov submit-legacy-proposal create-stream-proposal 1,2 40,60 10000dym --epoch-identifier minute --from hub-user -b block --title sfasfas --description ddasda --deposit 1dym -y --fees 1dym --gas auto +dymd tx gov submit-legacy-proposal create-stream-proposal 1,2 40,60 10000dym --epoch-identifier minute --from hub-user -b sync --title sfasfas --description ddasda --deposit 1dym -y --fees 1dym --gas auto last_proposal_id=$(dymd q gov proposals -o json | jq '.proposals | map(.id | tonumber) | max') -dymd tx gov vote "$last_proposal_id" yes --from hub-user -b block -y --fees 1dym +dymd tx gov vote "$last_proposal_id" yes --from hub-user -b sync -y --fees 1dym diff --git a/x/incentives/types/codec.go b/x/incentives/types/codec.go index 9bd8e9f4f..ece54925d 100644 --- a/x/incentives/types/codec.go +++ b/x/incentives/types/codec.go @@ -5,6 +5,7 @@ import ( cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" + authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) var ( @@ -29,3 +30,13 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } + +func init() { + RegisterCodec(amino) + // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be + // used to properly serialize MsgGrant and MsgExec instances + sdk.RegisterLegacyAminoCodec(amino) + RegisterCodec(authzcodec.Amino) + + amino.Seal() +} diff --git a/x/sponsorship/types/codec.go b/x/sponsorship/types/codec.go index ae10f0690..1ee422d11 100644 --- a/x/sponsorship/types/codec.go +++ b/x/sponsorship/types/codec.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" + authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterCodec registers the necessary x/sponsorship interfaces and concrete types on the provided @@ -25,3 +26,15 @@ func RegisterInterfaces(reg types.InterfaceRegistry) { ) msgservice.RegisterMsgServiceDesc(reg, &_Msg_serviceDesc) } + +var Amino = codec.NewLegacyAmino() + +func init() { + RegisterCodec(Amino) + // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be + // used to properly serialize MsgGrant and MsgExec instances + sdk.RegisterLegacyAminoCodec(Amino) + RegisterCodec(authzcodec.Amino) + + Amino.Seal() +}