diff --git a/CHANGELOG.md b/CHANGELOG.md index e5219884..e9136e66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,14 @@ Contains bug fixes. Contains all the PRs that improved the code without changing the behaviors. --> +# v1.0.6-fix +### Added + +### Changed + +### Fixed +- Fixed signatures not to be replayed across different networks + # v1.0.5-Prerelease ### Added - Arkeo testnet validator addresses to airdrop diff --git a/arkeocli/claim.go b/arkeocli/claim.go index 5e32935a..f5fe2c6b 100644 --- a/arkeocli/claim.go +++ b/arkeocli/claim.go @@ -1,6 +1,7 @@ package arkeocli import ( + "context" "strconv" "cosmossdk.io/errors" @@ -36,6 +37,18 @@ func runClaimCmd(cmd *cobra.Command, args []string) (err error) { return err } + node, err := clientCtx.GetNode() + if err != nil { + return errors.Wrapf(err, "failed to get node") + } + status, err := node.Status(context.Background()) + if err != nil { + return errors.Wrapf(err, "failed to get node status") + } + currentBlock := status.SyncInfo.LatestBlockHeight + + expiresAtBlock := currentBlock + types.DefaultSignatureExpiration + key, err := ensureKeys(cmd) if err != nil { return err @@ -80,7 +93,18 @@ func runClaimCmd(cmd *cobra.Command, args []string) (err error) { return err } - signBytes := types.GetBytesToSign(contract.Id, nonce) + chainId, err := cmd.Flags().GetString("chain-id") + if err != nil { + return errors.Wrapf(err, "chain-id should be specified") + } + if chainId == "" { + chainId, err = promptForArg(cmd, "Specify Chain ID: ") + if err != nil { + return err + } + } + + signBytes := types.GetBytesToSign(contract.Id, nonce, chainId, expiresAtBlock) signature, _, err := clientCtx.Keyring.Sign(key.Name, signBytes, signing.SignMode_SIGN_MODE_DIRECT) if err != nil { return errors.Wrapf(err, "error signing") @@ -91,6 +115,8 @@ func runClaimCmd(cmd *cobra.Command, args []string) (err error) { contract.Id, nonce, signature, + chainId, + expiresAtBlock, ) if err := msg.ValidateBasic(); err != nil { return err diff --git a/proto/arkeo/arkeo/tx.proto b/proto/arkeo/arkeo/tx.proto index a1386d74..7b7f2055 100644 --- a/proto/arkeo/arkeo/tx.proto +++ b/proto/arkeo/arkeo/tx.proto @@ -90,6 +90,8 @@ message MsgClaimContractIncome { uint64 contract_id = 2; bytes signature = 4; int64 nonce = 5; + string chain_id = 6; + int64 signature_expires_at_block = 7; } message MsgClaimContractIncomeResponse {} diff --git a/sentinel/auth.go b/sentinel/auth.go index e002ab10..854f0ef5 100644 --- a/sentinel/auth.go +++ b/sentinel/auth.go @@ -35,23 +35,25 @@ type ContractAuth struct { } type ArkAuth struct { - ContractId uint64 - Spender common.PubKey - Nonce int64 - Signature []byte + ContractId uint64 + Spender common.PubKey + Nonce int64 + Signature []byte + ChainId string + ExpiresAtBlock int64 } // String implement fmt.Stringer func (aa ArkAuth) String() string { - return GenerateArkAuthString(aa.ContractId, aa.Nonce, aa.Signature) + return GenerateArkAuthString(aa.ContractId, aa.Nonce, aa.Signature, aa.ChainId, aa.ExpiresAtBlock) } -func GenerateArkAuthString(contractId uint64, nonce int64, signature []byte) string { - return fmt.Sprintf("%s:%s", GenerateMessageToSign(contractId, nonce), hex.EncodeToString(signature)) +func GenerateArkAuthString(contractId uint64, nonce int64, signature []byte, chainId string, expiresAtBlock int64) string { + return fmt.Sprintf("%s:%s", GenerateMessageToSign(contractId, nonce, chainId, expiresAtBlock), hex.EncodeToString(signature)) } -func GenerateMessageToSign(contractId uint64, nonce int64) string { - return fmt.Sprintf("%d:%d", contractId, nonce) +func GenerateMessageToSign(contractId uint64, nonce int64, chainId string, expiresAtBlock int64) string { + return fmt.Sprintf("%d:%d:%s:%d", contractId, nonce, chainId, expiresAtBlock) } func parseContractAuth(raw string) (ContractAuth, error) { @@ -117,7 +119,7 @@ func (aa ArkAuth) Validate(provider common.PubKey) error { if err != nil { return fmt.Errorf("internal server error: %w", err) } - msg := types.NewMsgClaimContractIncome(creator, aa.ContractId, aa.Nonce, aa.Signature) + msg := types.NewMsgClaimContractIncome(creator, aa.ContractId, aa.Nonce, aa.Signature, aa.ChainId, aa.ExpiresAtBlock) err = msg.ValidateBasic() return err } diff --git a/sentinel/auth_test.go b/sentinel/auth_test.go index 533c7475..ab19e17b 100644 --- a/sentinel/auth_test.go +++ b/sentinel/auth_test.go @@ -40,6 +40,9 @@ func TestArkAuth(t *testing.T) { pk, err := common.NewPubKeyFromCrypto(pub) require.NoError(t, err) + chaindId := "arkeo-1" + expiresAtBlock := int64(10) + var signature []byte nonce := int64(3) service := common.BTCService @@ -50,13 +53,13 @@ func TestArkAuth(t *testing.T) { require.NoError(t, err) // happy path - raw := GenerateArkAuthString(contractId, nonce, signature) + raw := GenerateArkAuthString(contractId, nonce, signature, chaindId, expiresAtBlock) _, err = parseArkAuth(raw) require.NoError(t, err) // bad signature - raw = GenerateArkAuthString(contractId, nonce, signature) - _, err = parseArkAuth(raw + "randome not hex!") + raw = GenerateArkAuthString(contractId, nonce, signature, chaindId, expiresAtBlock) + _, err = parseArkAuth(raw + "random not hex!") require.Error(t, err) } diff --git a/test/regression/cmd/operations.go b/test/regression/cmd/operations.go index d8f4b4e1..133b2c20 100644 --- a/test/regression/cmd/operations.go +++ b/test/regression/cmd/operations.go @@ -279,6 +279,12 @@ func createContractAuth(input map[string]string) (string, bool, error) { if len(input["timestamp"]) == 0 { return "", true, fmt.Errorf("missing required field: timestamp") } + if len(input["chain_id"]) == 0 { + return "", true, fmt.Errorf("missing required field: chain_id") + } + if len(input["expires_at_block"]) == 0 { + return "", true, fmt.Errorf("missing required field: expires_at_block") + } id, err := strconv.ParseUint(input["id"], 10, 64) if err != nil { @@ -289,8 +295,13 @@ func createContractAuth(input map[string]string) (string, bool, error) { return "", true, fmt.Errorf("failed to parse timestamp: %s", err) } + expiresAtBlock, err := strconv.ParseInt(input["expires_at_block"], 10, 64) + if err != nil { + return "", true, fmt.Errorf("failed to parse timestamp: %s", err) + } + // sign our msg - msg := sentinel.GenerateMessageToSign(id, timestamp) + msg := sentinel.GenerateMessageToSign(id, timestamp, input["chain_id"], expiresAtBlock) auth, err := signThis(msg, input["signer"]) return auth, true, err } @@ -315,6 +326,18 @@ func createAuth(input map[string]string) (string, bool, error) { return "", true, fmt.Errorf("missing required field: nonce") } + if len(input["chain_id"]) == 0 { + return "", true, fmt.Errorf("missing required field: chain_id") + } + if len(input["expires_at_block"]) == 0 { + return "", true, fmt.Errorf("missing required field: expires_at_block") + } + + expiresAtBlock, err := strconv.ParseInt(input["expires_at_block"], 10, 64) + if err != nil { + return "", true, fmt.Errorf("failed to parse timestamp: %s", err) + } + id, err := strconv.ParseUint(input["id"], 10, 64) if err != nil { return "", true, fmt.Errorf("failed to parse id: %s", err) @@ -323,7 +346,7 @@ func createAuth(input map[string]string) (string, bool, error) { if err != nil { return "", true, fmt.Errorf("failed to parse nonce: %s", err) } - msg := sentinel.GenerateMessageToSign(id, nonce) + msg := sentinel.GenerateMessageToSign(id, nonce, input["chain_id"], expiresAtBlock) auth, err := signThis(msg, input["signer"]) return auth, true, err } diff --git a/tools/curleo/main.go b/tools/curleo/main.go index c2e8dd49..2b263d7d 100644 --- a/tools/curleo/main.go +++ b/tools/curleo/main.go @@ -52,6 +52,9 @@ func main() { head := flag.String("H", "", "header") flag.Parse() + chainId := flag.String("chain_id", "", "chain id") + expiresAtBlock := flag.Int64("expires_at_block", 0, "block expiration time") + c := cosmos.GetConfig() c.SetBech32PrefixForAccount(app.AccountAddressPrefix, app.AccountAddressPrefix+"pub") @@ -77,7 +80,7 @@ func main() { println(fmt.Sprintf("no active contract found for provider:%s cbhain:%s - will attempt free tier", metadata.Configuration.ProviderPubKey.String(), service)) } else { claim := curl.getClaim(contract.Id) - auth := curl.sign(*user, contract.Id, claim.Nonce+1) + auth := curl.sign(*user, contract.Id, claim.Nonce+1, *chainId, *expiresAtBlock) values.Add(sentinel.QueryArkAuth, auth) } u.RawQuery = values.Encode() @@ -189,7 +192,7 @@ func (c Curl) parseMetadata() sentinel.Metadata { return meta } -func (c Curl) sign(user string, contractId uint64, nonce int64) string { +func (c Curl) sign(user string, contractId uint64, nonce int64, chainId string, expiresAtBlock int64) string { interfaceRegistry := codectypes.NewInterfaceRegistry() std.RegisterInterfaces(interfaceRegistry) ModuleBasics.RegisterInterfaces(interfaceRegistry) @@ -203,7 +206,7 @@ func (c Curl) sign(user string, contractId uint64, nonce int64) string { if err != nil { log.Fatal(err) } - msg := sentinel.GenerateMessageToSign(contractId, nonce) + msg := sentinel.GenerateMessageToSign(contractId, nonce, chainId, expiresAtBlock) println("invoking Sign...") signature, pk, err := kb.Sign(user, []byte(msg), signing.SignMode_SIGN_MODE_DIRECT) diff --git a/x/arkeo/client/cli/tx_claim_contract_income.go b/x/arkeo/client/cli/tx_claim_contract_income.go index f90190c4..99cf1de2 100644 --- a/x/arkeo/client/cli/tx_claim_contract_income.go +++ b/x/arkeo/client/cli/tx_claim_contract_income.go @@ -1,6 +1,7 @@ package cli import ( + "context" "encoding/hex" "github.com/arkeonetwork/arkeo/x/arkeo/types" @@ -14,7 +15,7 @@ import ( func CmdClaimContractIncome() *cobra.Command { cmd := &cobra.Command{ - Use: "claim-contract-income [contract-id] [nonce] [signature]", + Use: "claim-contract-income [contract-id] [nonce] [signature] [chain-id]", Short: "Broadcast message claimContractIncome", Args: cobra.ExactArgs(4), RunE: func(cmd *cobra.Command, args []string) (err error) { @@ -32,15 +33,41 @@ func CmdClaimContractIncome() *cobra.Command { if err != nil { return err } + signature, err := hex.DecodeString(args[2]) if err != nil { return err } + + chainID := args[3] + + node, err := clientCtx.GetNode() + if err != nil { + return err + } + + status, err := node.Status(context.Background()) + if err != nil { + return err + } + currentBlock := status.SyncInfo.LatestBlockHeight + + // Get expiration delta from flags (default to 50 blocks if not specified) + expirationDelta, err := cmd.Flags().GetInt64("expiration-delta") + if err != nil { + expirationDelta = 50 + } + + // Calculate expiration block + expiresAtBlock := currentBlock + expirationDelta + msg := types.NewMsgClaimContractIncome( clientCtx.GetFromAddress(), argContractId, argNonce, signature, + chainID, + expiresAtBlock, ) if err := msg.ValidateBasic(); err != nil { return err @@ -50,6 +77,7 @@ func CmdClaimContractIncome() *cobra.Command { } flags.AddTxFlagsToCmd(cmd) + cmd.Flags().Int64("expiration-delta", 50, "number of blocks until expiration") return cmd } diff --git a/x/arkeo/keeper/keeper_test.go b/x/arkeo/keeper/keeper_test.go index 909b84e4..8fec5994 100644 --- a/x/arkeo/keeper/keeper_test.go +++ b/x/arkeo/keeper/keeper_test.go @@ -217,7 +217,7 @@ func SetupKeeperWithStaking(t testing.TB) (cosmos.Context, Keeper, stakingkeeper "ArkeoParams", ) - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()).WithChainID("arkeo-1") govModuleAddr := "tarkeo1krj9ywwmqcellgunxg66kjw5dtt402kq0uf6pu" _ = paramskeeper.NewKeeper(cdc, amino, keyParams, tkeyParams) diff --git a/x/arkeo/keeper/msg_server_claim_contract_income.go b/x/arkeo/keeper/msg_server_claim_contract_income.go index 8957526c..852ffd57 100644 --- a/x/arkeo/keeper/msg_server_claim_contract_income.go +++ b/x/arkeo/keeper/msg_server_claim_contract_income.go @@ -37,11 +37,22 @@ func (k msgServer) HandlerClaimContractIncome(ctx cosmos.Context, msg *types.Msg } contract, err := k.GetContract(ctx, msg.ContractId) - if err != nil { return err } + if msg.ChainId != ctx.ChainID() { + return errors.Wrapf(types.ErrInvalidChainID, "expected %s, got %s", ctx.ChainID(), msg.ChainId) + + } + + if msg.SignatureExpiresAtBlock <= ctx.BlockHeight() { + return errors.Wrapf(types.ErrSignatureExpired, + "current block height %d is greater than or equal to expiration block %d", + ctx.BlockHeight(), + msg.SignatureExpiresAtBlock) + } + if contract.Nonce >= msg.Nonce { return errors.Wrapf(types.ErrClaimContractIncomeBadNonce, "contract nonce (%d) is greater than msg nonce (%d)", contract.Nonce, msg.Nonce) } @@ -62,7 +73,6 @@ func (k msgServer) HandlerClaimContractIncome(ctx cosmos.Context, msg *types.Msg } // excute settlement - _, err = k.mgr.SettleContract(ctx, contract, msg.Nonce, false) if err != nil { return err diff --git a/x/arkeo/keeper/msg_server_claim_contract_income_test.go b/x/arkeo/keeper/msg_server_claim_contract_income_test.go index 1550d4d2..bb2b7630 100644 --- a/x/arkeo/keeper/msg_server_claim_contract_income_test.go +++ b/x/arkeo/keeper/msg_server_claim_contract_income_test.go @@ -54,15 +54,17 @@ func TestValidate(t *testing.T) { contract.Deposit = cosmos.NewInt(contract.Duration * contract.Rate.Amount.Int64()) contract.Id = 1 require.NoError(t, k.SetContract(ctx, contract)) - require.NoError(t, k.MintToModule(ctx, types.ModuleName, getCoin(common.Tokens(10000*100*2)))) - require.NoError(t, k.SendFromModuleToModule(ctx, types.ModuleName, types.ContractName, getCoins(1000*100))) + require.NoError(t, k.MintToModule(ctx, types.ReserveName, getCoin(common.Tokens(10000*100*2)))) + require.NoError(t, k.SendFromModuleToModule(ctx, types.ReserveName, types.ContractName, getCoins(1000*100))) // happy path msg := types.MsgClaimContractIncome{ - ContractId: contract.Id, - Creator: acc.String(), - Nonce: 20, + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 20, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, } message := msg.GetBytesToSign() @@ -73,9 +75,11 @@ func TestValidate(t *testing.T) { // check closed contract ctx = ctx.WithBlockHeight(ctx.BlockHeight() + contract.Duration) msg = types.MsgClaimContractIncome{ - ContractId: contract.Id, - Creator: acc.String(), - Nonce: 21, + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 21, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, } err = s.HandlerClaimContractIncome(ctx, &msg) require.ErrorIs(t, err, types.ErrClaimContractIncomeClosed) @@ -122,9 +126,11 @@ func TestHandlePayAsYouGo(t *testing.T) { // happy path msg := types.MsgClaimContractIncome{ - ContractId: contract.Id, - Creator: acc.String(), - Nonce: 20, + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 20, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, } message := msg.GetBytesToSign() @@ -138,9 +144,11 @@ func TestHandlePayAsYouGo(t *testing.T) { require.Equal(t, k.GetBalanceOfModule(ctx, types.ModuleName, configs.Denom).Int64(), int64(999999999020)) msg = types.MsgClaimContractIncome{ - ContractId: contract.Id, - Creator: acc.String(), - Nonce: 21, + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 21, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, } message = msg.GetBytesToSign() @@ -218,9 +226,11 @@ func TestHandleSubscription(t *testing.T) { // happy path msg := types.MsgClaimContractIncome{ - ContractId: contract.Id, - Creator: acc.String(), - Nonce: 20, + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 20, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, } require.NoError(t, s.HandlerClaimContractIncome(ctx, &msg)) @@ -229,9 +239,11 @@ func TestHandleSubscription(t *testing.T) { require.Equal(t, k.GetBalanceOfModule(ctx, types.ModuleName, configs.Denom).Int64(), int64(999999999010)) msg = types.MsgClaimContractIncome{ - ContractId: contract.Id, - Creator: acc.String(), - Nonce: 21, + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 21, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, } // repeat the same thing and ensure we don't pay providers twice require.NoError(t, s.HandlerClaimContractIncome(ctx, &msg)) @@ -255,6 +267,7 @@ func TestHandleSubscription(t *testing.T) { // ensure provider cannot take more than what is deposited into the account, overspend the contract ctx = ctx.WithBlockHeight(110) msg.Nonce = 100 + msg.SignatureExpiresAtBlock = ctx.BlockHeight() + types.DefaultSignatureExpiration require.NoError(t, s.HandlerClaimContractIncome(ctx, &msg)) acct = k.GetBalance(ctx, acc).AmountOf(configs.Denom).Int64() require.Equal(t, acct, int64(900)) @@ -306,9 +319,11 @@ func TestClaimContractIncomeHandler(t *testing.T) { // happy path msg := types.MsgClaimContractIncome{ - ContractId: contract.Id, - Creator: acc.String(), - Nonce: 20, + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 20, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, } message := msg.GetBytesToSign() @@ -373,11 +388,258 @@ func TestClaimContractIncomeHandlerSignatureVerification(t *testing.T) { // happy path msg := types.MsgClaimContractIncome{ - ContractId: contract.Id, - Creator: acc.String(), - Nonce: 20, + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 20, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, } err = s.HandlerClaimContractIncome(ctx, &msg) require.Error(t, err, types.ErrClaimContractIncomeInvalidSignature) } + +func TestClaimContractIncomeHandlerExpirationAndChainID(t *testing.T) { + var err error + ctx, k, sk := SetupKeeperWithStaking(t) + ctx = ctx.WithBlockHeight(20) + + s := newMsgServer(k, sk) + + // setup + interfaceRegistry := codectypes.NewInterfaceRegistry() + std.RegisterInterfaces(interfaceRegistry) + module.NewBasicManager().RegisterInterfaces(interfaceRegistry) + types.RegisterInterfaces(interfaceRegistry) + cdc := codec.NewProtoCodec(interfaceRegistry) + + pubkey := types.GetRandomPubKey() + acc, err := pubkey.GetMyAddress() + require.NoError(t, err) + service := common.BTCService + kb := cKeys.NewInMemory(cdc) + info, _, err := kb.NewMnemonic("whatever", cKeys.English, `m/44'/931'/0'/0/0`, "", hd.Secp256k1) + require.NoError(t, err) + pk, err := info.GetPubKey() + require.NoError(t, err) + client, err := common.NewPubKeyFromCrypto(pk) + require.NoError(t, err) + + require.NoError(t, k.MintToModule(ctx, types.ReserveName, getCoin(common.Tokens(10000*100*2)))) + require.NoError(t, k.SendFromModuleToModule(ctx, types.ReserveName, types.ContractName, getCoins(1000*100))) + + rate, err := cosmos.ParseCoin("10uarkeo") + require.NoError(t, err) + + contract := types.NewContract(pubkey, service, client) + contract.Duration = 101 + contract.Rate = rate + contract.Type = types.ContractType_PAY_AS_YOU_GO + contract.Deposit = cosmos.NewInt(contract.Duration * contract.Rate.Amount.Int64()) + contract.Id = 2 + require.NoError(t, k.SetContract(ctx, contract)) + + // Test Expired Transaction + msg := types.MsgClaimContractIncome{ + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 20, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, + } + ctx = ctx.WithBlockHeight(100) + message := msg.GetBytesToSign() + msg.Signature, _, err = kb.Sign("whatever", message, signing.SignMode_SIGN_MODE_DIRECT) + require.NoError(t, err) + + err = s.HandlerClaimContractIncome(ctx, &msg) + require.ErrorIs(t, err, types.ErrSignatureExpired) + + // Test Wrong Chain ID + msg = types.MsgClaimContractIncome{ + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 20, + ChainId: "wrong-chain-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, + } + + message = msg.GetBytesToSign() + msg.Signature, _, err = kb.Sign("whatever", message, signing.SignMode_SIGN_MODE_DIRECT) + require.NoError(t, err) + + err = s.HandlerClaimContractIncome(ctx, &msg) + require.ErrorIs(t, err, types.ErrInvalidChainID) + + // Test Invalid signature for modified chain ID + msg = types.MsgClaimContractIncome{ + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 20, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + 100, + } + + message = msg.GetBytesToSign() + msg.Signature, _, err = kb.Sign("whatever", message, signing.SignMode_SIGN_MODE_DIRECT) + require.NoError(t, err) + + // Modify chain ID after signing + msg.ChainId = "different-chain-1" + + err = s.HandlerClaimContractIncome(ctx, &msg) + require.ErrorIs(t, err, types.ErrInvalidChainID) + + // Test Valid transaction with future expiration + msg = types.MsgClaimContractIncome{ + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 20, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, + } + + message = msg.GetBytesToSign() + msg.Signature, _, err = kb.Sign("whatever", message, signing.SignMode_SIGN_MODE_DIRECT) + require.NoError(t, err) + + require.NoError(t, s.HandlerClaimContractIncome(ctx, &msg)) + + // test signature expiry equal to current block height + msg = types.MsgClaimContractIncome{ + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 20, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight(), + } + ctx = ctx.WithBlockHeight(100) + message = msg.GetBytesToSign() + msg.Signature, _, err = kb.Sign("whatever", message, signing.SignMode_SIGN_MODE_DIRECT) + require.NoError(t, err) + + err = s.HandlerClaimContractIncome(ctx, &msg) + require.ErrorIs(t, err, types.ErrSignatureExpired) +} + +func TestSignatureVerificationWithNewFields(t *testing.T) { + var err error + ctx, k, sk := SetupKeeperWithStaking(t) + ctx = ctx.WithBlockHeight(20) + + s := newMsgServer(k, sk) + + // setup + interfaceRegistry := codectypes.NewInterfaceRegistry() + std.RegisterInterfaces(interfaceRegistry) + module.NewBasicManager().RegisterInterfaces(interfaceRegistry) + types.RegisterInterfaces(interfaceRegistry) + cdc := codec.NewProtoCodec(interfaceRegistry) + + pubkey := types.GetRandomPubKey() + acc, err := pubkey.GetMyAddress() + require.NoError(t, err) + service := common.BTCService + kb := cKeys.NewInMemory(cdc) + info, _, err := kb.NewMnemonic("whatever", cKeys.English, `m/44'/931'/0'/0/0`, "", hd.Secp256k1) + require.NoError(t, err) + pk, err := info.GetPubKey() + require.NoError(t, err) + client, err := common.NewPubKeyFromCrypto(pk) + require.NoError(t, err) + + rate, err := cosmos.ParseCoin("10uarkeo") + require.NoError(t, err) + + require.NoError(t, k.MintToModule(ctx, types.ReserveName, getCoin(common.Tokens(10000*100*2)))) + require.NoError(t, k.SendFromModuleToModule(ctx, types.ReserveName, types.ContractName, getCoins(1000*100))) + + contract := types.NewContract(pubkey, service, client) + contract.Duration = 100 + contract.Rate = rate + contract.Type = types.ContractType_PAY_AS_YOU_GO + contract.Deposit = cosmos.NewInt(contract.Duration * contract.Rate.Amount.Int64()) + contract.Id = 2 + require.NoError(t, k.SetContract(ctx, contract)) + + // Test Verify all fields are included in signature + msg := types.MsgClaimContractIncome{ + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 20, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, + } + + message := msg.GetBytesToSign() + msg.Signature, _, err = kb.Sign("whatever", message, signing.SignMode_SIGN_MODE_DIRECT) + require.NoError(t, err) + + // Verify original message passes + require.NoError(t, s.HandlerClaimContractIncome(ctx, &msg)) + + contract = types.NewContract(pubkey, service, client) + contract.Duration = 100 + contract.Rate = rate + contract.Type = types.ContractType_PAY_AS_YOU_GO + contract.Deposit = cosmos.NewInt(contract.Duration * contract.Rate.Amount.Int64()) + contract.Id = 10 + require.NoError(t, k.SetContract(ctx, contract)) + + msg = types.MsgClaimContractIncome{ + ContractId: contract.Id, + Creator: acc.String(), + Nonce: 20, + ChainId: "arkeo-1", + SignatureExpiresAtBlock: ctx.BlockHeight() + types.DefaultSignatureExpiration, + } + + // Test Modifying any field after signing should fail + testCases := []struct { + name string + mutator func(*types.MsgClaimContractIncome) + err error + }{ + { + name: "modify contract id", + mutator: func(m *types.MsgClaimContractIncome) { + m.ContractId = 999 + m.Nonce = 21 + }, + err: types.ErrClaimContractIncomeClosed, + }, + { + name: "modify nonce", + mutator: func(m *types.MsgClaimContractIncome) { + m.Nonce = 999 + }, + err: types.ErrClaimContractIncomeInvalidSignature, + }, + { + name: "modify chain id", + mutator: func(m *types.MsgClaimContractIncome) { + m.ChainId = "modified-chain-1" + m.Nonce = 1000 + }, + err: types.ErrInvalidChainID, + }, + { + name: "modify expiration", + mutator: func(m *types.MsgClaimContractIncome) { + m.SignatureExpiresAtBlock = ctx.BlockHeight() + 200 + m.Nonce = 1001 + }, + err: types.ErrClaimContractIncomeInvalidSignature, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + modifiedMsg := msg + tc.mutator(&modifiedMsg) + + err = s.HandlerClaimContractIncome(ctx, &modifiedMsg) + require.ErrorIs(t, err, tc.err) + }) + } +} diff --git a/x/arkeo/types/errors.go b/x/arkeo/types/errors.go index 1f275beb..2f80d182 100644 --- a/x/arkeo/types/errors.go +++ b/x/arkeo/types/errors.go @@ -41,4 +41,6 @@ var ( ErrInvariantMaxSupply = errors.Register(ModuleName, 32, "max supply invariant") ErrInvalidAuthorization = errors.Register(ModuleName, 33, "invalid authorization") ErrInvalidVersion = errors.Register(ModuleName, 34, "version cannot be zero or lower") + ErrInvalidChainID = errors.Register(ModuleName, 35, "invalid chain ID") + ErrSignatureExpired = errors.Register(ModuleName, 36, "signature expired") ) diff --git a/x/arkeo/types/message_claim_contract_income.go b/x/arkeo/types/message_claim_contract_income.go index 95929424..232f6fd8 100644 --- a/x/arkeo/types/message_claim_contract_income.go +++ b/x/arkeo/types/message_claim_contract_income.go @@ -4,6 +4,7 @@ import ( "fmt" "cosmossdk.io/errors" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -14,12 +15,14 @@ const TypeMsgClaimContractIncome = "claim_contract_income" var _ sdk.Msg = &MsgClaimContractIncome{} -func NewMsgClaimContractIncome(creator cosmos.AccAddress, contractId uint64, nonce int64, sig []byte) *MsgClaimContractIncome { +func NewMsgClaimContractIncome(creator cosmos.AccAddress, contractId uint64, nonce int64, sig []byte, chainId string, expiresAtBlock int64) *MsgClaimContractIncome { return &MsgClaimContractIncome{ - Creator: creator.String(), - ContractId: contractId, - Nonce: nonce, - Signature: sig, + Creator: creator.String(), + ContractId: contractId, + Nonce: nonce, + Signature: sig, + ChainId: chainId, + SignatureExpiresAtBlock: expiresAtBlock, } } @@ -40,16 +43,15 @@ func (msg *MsgClaimContractIncome) MustGetSigner() sdk.AccAddress { } func (msg *MsgClaimContractIncome) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) + return ModuleCdc.MustMarshalJSON(msg) } func (msg *MsgClaimContractIncome) GetBytesToSign() []byte { - return GetBytesToSign(msg.ContractId, msg.Nonce) + return GetBytesToSign(msg.ContractId, msg.Nonce, msg.ChainId, msg.SignatureExpiresAtBlock) } -func GetBytesToSign(contractId uint64, nonce int64) []byte { - return []byte(fmt.Sprintf("%d:%d", contractId, nonce)) +func GetBytesToSign(contractId uint64, nonce int64, chainId string, expiresAtBlock int64) []byte { + return []byte(fmt.Sprintf("%d:%d:%s:%d", contractId, nonce, chainId, expiresAtBlock)) } func (msg *MsgClaimContractIncome) ValidateBasic() error { @@ -59,8 +61,16 @@ func (msg *MsgClaimContractIncome) ValidateBasic() error { return errors.Wrap(ErrClaimContractIncomeInvalidSignature, "too long") } + if len(msg.ChainId) == 0 { + return errors.Wrap(sdkerrors.ErrInvalidRequest, "chain ID cannot be empty") + } + if msg.Nonce <= 0 { - return errors.Wrap(ErrClaimContractIncomeBadNonce, "") + return errors.Wrap(ErrClaimContractIncomeBadNonce, "nonce must be greater than zero") + } + + if msg.SignatureExpiresAtBlock <= 0 { + return errors.Wrap(sdkerrors.ErrInvalidRequest, "expiration block height must be positive") } return nil diff --git a/x/arkeo/types/query.pb.gw.go b/x/arkeo/types/query.pb.gw.go index 8f7ce4dc..6125cc43 100644 --- a/x/arkeo/types/query.pb.gw.go +++ b/x/arkeo/types/query.pb.gw.go @@ -1,7 +1,5 @@ // DONTCOVER // DONTCOVER -// DONTCOVER -// DONTCOVER // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: arkeo/arkeo/query.proto diff --git a/x/arkeo/types/tx.pb.go b/x/arkeo/types/tx.pb.go index b6257e4b..27dc731c 100644 --- a/x/arkeo/types/tx.pb.go +++ b/x/arkeo/types/tx.pb.go @@ -558,10 +558,12 @@ func (m *MsgCloseContractResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCloseContractResponse proto.InternalMessageInfo type MsgClaimContractIncome struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - ContractId uint64 `protobuf:"varint,2,opt,name=contract_id,json=contractId,proto3" json:"contract_id,omitempty"` - Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` - Nonce int64 `protobuf:"varint,5,opt,name=nonce,proto3" json:"nonce,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + ContractId uint64 `protobuf:"varint,2,opt,name=contract_id,json=contractId,proto3" json:"contract_id,omitempty"` + Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` + Nonce int64 `protobuf:"varint,5,opt,name=nonce,proto3" json:"nonce,omitempty"` + ChainId string `protobuf:"bytes,6,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + SignatureExpiresAtBlock int64 `protobuf:"varint,7,opt,name=signature_expires_at_block,json=signatureExpiresAtBlock,proto3" json:"signature_expires_at_block,omitempty"` } func (m *MsgClaimContractIncome) Reset() { *m = MsgClaimContractIncome{} } @@ -625,6 +627,20 @@ func (m *MsgClaimContractIncome) GetNonce() int64 { return 0 } +func (m *MsgClaimContractIncome) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *MsgClaimContractIncome) GetSignatureExpiresAtBlock() int64 { + if m != nil { + return m.SignatureExpiresAtBlock + } + return 0 +} + type MsgClaimContractIncomeResponse struct { } @@ -768,75 +784,78 @@ func init() { func init() { proto.RegisterFile("arkeo/arkeo/tx.proto", fileDescriptor_a12700967a3e4015) } var fileDescriptor_a12700967a3e4015 = []byte{ - // 1085 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x41, 0x4f, 0xdc, 0x46, - 0x14, 0xc6, 0xd9, 0x05, 0xc2, 0xec, 0x42, 0xc9, 0x00, 0xc1, 0x2c, 0x64, 0xd9, 0x6e, 0x12, 0x09, - 0x41, 0xf0, 0x8a, 0x45, 0xbd, 0x70, 0x68, 0x05, 0x34, 0x4a, 0x11, 0xd9, 0x06, 0x99, 0xa6, 0x52, - 0x7b, 0x59, 0xcd, 0xda, 0x23, 0x33, 0x02, 0xcf, 0xb8, 0x33, 0x63, 0xca, 0xf6, 0x54, 0xf5, 0xd8, - 0xaa, 0x52, 0xa5, 0xfe, 0x8f, 0x8a, 0x43, 0x7e, 0x44, 0x8e, 0x51, 0x4e, 0x51, 0x0f, 0x28, 0x82, - 0x03, 0x97, 0xfe, 0x82, 0x9e, 0x2a, 0xdb, 0x63, 0xaf, 0xed, 0x5d, 0x28, 0x49, 0xd4, 0x5e, 0xbc, - 0xfb, 0xde, 0xf7, 0xde, 0x9b, 0xf7, 0x3e, 0x7f, 0x33, 0x1e, 0x30, 0x8d, 0xf8, 0x21, 0x66, 0x8d, - 0xe8, 0x29, 0x4f, 0x0c, 0x8f, 0x33, 0xc9, 0x60, 0x29, 0xb4, 0x8d, 0xf0, 0x59, 0x99, 0x76, 0x98, - 0xc3, 0x42, 0x7f, 0x23, 0xf8, 0x17, 0x85, 0x54, 0xe6, 0x2c, 0x26, 0x5c, 0x26, 0xda, 0x11, 0x10, - 0x19, 0x0a, 0xaa, 0x46, 0x56, 0xa3, 0x83, 0x04, 0x6e, 0x1c, 0xaf, 0x75, 0xb0, 0x44, 0x6b, 0x0d, - 0x8b, 0x11, 0xaa, 0x70, 0x3d, 0xbd, 0xe6, 0x21, 0xc6, 0x1e, 0xe6, 0x0a, 0x99, 0x55, 0x99, 0xae, - 0x70, 0x1a, 0xc7, 0x6b, 0xc1, 0x8f, 0x02, 0xee, 0x20, 0x97, 0x50, 0xd6, 0x08, 0x9f, 0x91, 0xab, - 0xfe, 0x97, 0x06, 0x3e, 0x6a, 0x09, 0x67, 0x8b, 0x51, 0x7b, 0x8f, 0xb3, 0x63, 0x62, 0x63, 0x0e, - 0x9b, 0x60, 0xd4, 0xe2, 0x18, 0x49, 0xc6, 0x75, 0xad,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 0x39, 0x89, - 0x18, 0x34, 0x4b, 0xb1, 0xef, 0x39, 0x27, 0xf0, 0x21, 0x98, 0x48, 0x42, 0x28, 0xa3, 0x16, 0xd6, - 0x87, 0x6b, 0xda, 0x52, 0xd1, 0x1c, 0x8f, 0xbd, 0x5f, 0x06, 0x4e, 0xb8, 0x0e, 0x46, 0x84, 0x44, - 0xd2, 0x17, 0xfa, 0x48, 0x4d, 0x5b, 0x9a, 0x68, 0xce, 0x1b, 0x29, 0xd9, 0x1a, 0x31, 0x17, 0xfb, - 0x61, 0x88, 0xa9, 0x42, 0x61, 0x13, 0xcc, 0xb8, 0x84, 0xb6, 0x2d, 0x46, 0x25, 0x47, 0x96, 0x6c, - 0xdb, 0x3e, 0x47, 0x92, 0x30, 0xaa, 0x8f, 0xd6, 0xb4, 0xa5, 0x82, 0x39, 0xe5, 0x12, 0xba, 0xad, - 0xb0, 0xcf, 0x15, 0x14, 0xe6, 0xa0, 0x93, 0x01, 0x39, 0xb7, 0x55, 0x0e, 0x3a, 0xe9, 0xcb, 0x79, - 0x0a, 0xee, 0x08, 0xbf, 0x23, 0x2c, 0x4e, 0xbc, 0xc0, 0x6e, 0x73, 0x24, 0xb1, 0x3e, 0x56, 0x2b, - 0x2c, 0x95, 0x9a, 0x73, 0x86, 0x7a, 0x11, 0xc1, 0x06, 0x31, 0xd4, 0x06, 0x31, 0xb6, 0x19, 0xa1, - 0x5b, 0xc5, 0x40, 0x48, 0xe6, 0x64, 0x3a, 0xd3, 0x44, 0x12, 0xc3, 0x5d, 0x00, 0x3d, 0xd4, 0x6d, - 0x23, 0xd1, 0xee, 0x32, 0xbf, 0xed, 0xb0, 0xa8, 0x1c, 0xb8, 0x59, 0xb9, 0x09, 0x0f, 0x75, 0x37, - 0xc5, 0x37, 0xcc, 0x7f, 0xc2, 0xc2, 0x62, 0x0d, 0x30, 0x25, 0xb0, 0x94, 0x47, 0xd8, 0xc5, 0x34, - 0x35, 0x4c, 0x29, 0x1c, 0x06, 0xf6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 0x06, 0x4a, 0xe9, 0x0b, 0xc7, 0x7c, 0x3e, 0x29, 0x05, 0x56, 0xee, 0x5f, 0x03, - 0x26, 0x05, 0x4d, 0x50, 0xce, 0x7c, 0x17, 0xfa, 0x9a, 0x4c, 0xa3, 0xfd, 0x4d, 0x0e, 0xda, 0xf1, - 0xf0, 0x39, 0x18, 0xcf, 0xee, 0xf6, 0x7b, 0xf9, 0xb4, 0x0c, 0x5c, 0x79, 0x78, 0x2d, 0x9c, 0x94, - 0x75, 0xc0, 0xd4, 0x20, 0xdd, 0xdf, 0xef, 0xcf, 0xee, 0x0b, 0xaa, 0xac, 0xdc, 0x20, 0x28, 0x59, - 0xe8, 0x29, 0x00, 0x29, 0x8d, 0x55, 0xf2, 0xa9, 0x3d, 0xac, 0x52, 0xbf, 0x1a, 0x8b, 0xab, 0x55, - 0x86, 0x7f, 0xbc, 0x3c, 0x5d, 0xd6, 0xb6, 0x1e, 0xbf, 0x3c, 0xaf, 0x6a, 0xaf, 0xce, 0xab, 0xda, - 0xdb, 0xf3, 0xaa, 0xf6, 0xdb, 0x45, 0x75, 0xe8, 0xd5, 0x45, 0x75, 0xe8, 0xcd, 0x45, 0x75, 0xe8, - 0xdb, 0x7f, 0x39, 0x57, 0x62, 0xf5, 0x05, 0xdf, 0x41, 0xd1, 0x19, 0x09, 0xaf, 0xe1, 0xeb, 0xff, - 0x04, 0x00, 0x00, 0xff, 0xff, 0xde, 0x1f, 0x86, 0xaf, 0x42, 0x0c, 0x00, 0x00, + // 1132 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x41, 0x4f, 0x1b, 0x47, + 0x14, 0xc6, 0xb1, 0x81, 0x30, 0x36, 0x34, 0x99, 0x90, 0xb0, 0x6c, 0x12, 0xe3, 0x3a, 0x89, 0x84, + 0x20, 0xac, 0x85, 0x51, 0x2f, 0x54, 0x6a, 0x85, 0x29, 0x4a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 0xfc, 0xee, 0x50, 0xe3, 0xfd, 0xb5, + 0xeb, 0x73, 0xe0, 0xf6, 0x80, 0x23, 0x69, 0xb3, 0xf9, 0x5b, 0x09, 0x14, 0xdb, 0xc2, 0x85, 0x26, + 0xa8, 0x0c, 0x5c, 0xbf, 0xee, 0x0d, 0x0c, 0x83, 0xdc, 0x75, 0x45, 0x7f, 0x78, 0x19, 0x9a, 0xd4, + 0x86, 0xcf, 0x40, 0x39, 0x7b, 0x91, 0xb9, 0x9b, 0x4f, 0xca, 0x80, 0xfa, 0x83, 0x4b, 0xc0, 0xb4, + 0xa0, 0x09, 0x2a, 0x03, 0xdf, 0x9b, 0xa1, 0x26, 0xb3, 0xe8, 0x70, 0x93, 0xa3, 0x26, 0x09, 0x7c, + 0x0e, 0xa6, 0x07, 0xa7, 0xc8, 0xfd, 0x7c, 0xda, 0x00, 0xac, 0x3f, 0xba, 0x14, 0x4e, 0xcb, 0xba, + 0xe0, 0xd6, 0xa8, 0xf3, 0xf4, 0x60, 0x38, 0x7b, 0x28, 0x48, 0x5f, 0xbe, 0x42, 0x50, 0xba, 0xd0, + 0x53, 0x00, 0x32, 0x1a, 0xd3, 0xf3, 0xa9, 0x7d, 0x4c, 0xaf, 0x5f, 0x8c, 0x25, 0xd5, 0xf4, 0xf1, + 0x1f, 0xce, 0x8f, 0x97, 0x0a, 0xad, 0xad, 0x97, 0xa7, 0xd5, 0xc2, 0xab, 0xd3, 0x6a, 0xe1, 0xcd, + 0x69, 0xb5, 0xf0, 0xeb, 0x59, 0x75, 0xec, 0xd5, 0x59, 0x75, 0xec, 0x8f, 0xb3, 0xea, 0xd8, 0x37, + 0xff, 0x32, 0xaf, 0x12, 0xf5, 0x85, 0xdf, 0x57, 0xd1, 0x99, 0x88, 0xae, 0xf7, 0x6b, 0xff, 0x04, + 0x00, 0x00, 0xff, 0xff, 0xba, 0xe6, 0x23, 0xd8, 0x9a, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1524,6 +1543,18 @@ func (m *MsgClaimContractIncome) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.SignatureExpiresAtBlock != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.SignatureExpiresAtBlock)) + i-- + dAtA[i] = 0x38 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0x32 + } if m.Nonce != 0 { i = encodeVarintTx(dAtA, i, uint64(m.Nonce)) i-- @@ -1846,6 +1877,13 @@ func (m *MsgClaimContractIncome) Size() (n int) { if m.Nonce != 0 { n += 1 + sovTx(uint64(m.Nonce)) } + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.SignatureExpiresAtBlock != 0 { + n += 1 + sovTx(uint64(m.SignatureExpiresAtBlock)) + } return n } @@ -3286,6 +3324,57 @@ func (m *MsgClaimContractIncome) Unmarshal(dAtA []byte) error { break } } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SignatureExpiresAtBlock", wireType) + } + m.SignatureExpiresAtBlock = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SignatureExpiresAtBlock |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/arkeo/types/types.go b/x/arkeo/types/types.go index d3631d26..b4c6e4e3 100644 --- a/x/arkeo/types/types.go +++ b/x/arkeo/types/types.go @@ -11,6 +11,8 @@ import ( "github.com/tendermint/tendermint/crypto" ) +const DefaultSignatureExpiration = int64(50) // SIGNATURE EXPIRES AFTER 50 Blocks + // GetRandomBech32Addr is an account address used for test func GetRandomBech32Addr() cosmos.AccAddress { name := common.RandStringBytesMask(10) diff --git a/x/claim/types/query.pb.gw.go b/x/claim/types/query.pb.gw.go index db3e5fea..81e44b20 100644 --- a/x/claim/types/query.pb.gw.go +++ b/x/claim/types/query.pb.gw.go @@ -1,7 +1,5 @@ // DONTCOVER // DONTCOVER -// DONTCOVER -// DONTCOVER // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: arkeo/claim/query.proto diff --git a/x/claim/types/tx.pb.go b/x/claim/types/tx.pb.go index f8af405a..21e5a1c2 100644 --- a/x/claim/types/tx.pb.go +++ b/x/claim/types/tx.pb.go @@ -577,50 +577,50 @@ func init() { proto.RegisterFile("arkeo/claim/tx.proto", fileDescriptor_6a4ddac6 var fileDescriptor_6a4ddac60cb43154 = []byte{ // 701 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x4f, 0x13, 0x4f, - 0x18, 0x66, 0xe9, 0x8f, 0x7f, 0x6f, 0xa1, 0x81, 0xfd, 0x81, 0x2e, 0xab, 0x2c, 0xb8, 0x89, 0x84, - 0x54, 0xe9, 0x6a, 0x4d, 0xd0, 0x54, 0x2f, 0x85, 0x40, 0x62, 0x22, 0x97, 0x8a, 0x89, 0xf1, 0xd2, - 0x2c, 0xed, 0xb0, 0xdb, 0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x09, 0x63, 0xb4, 0xe5, - 0x85, 0x2e, 0xdb, 0x27, 0xc8, 0xc8, 0x71, 0xf8, 0x22, 0x50, 0x29, 0x7e, 0x3a, 0x3f, 0x2c, 0xca, - 0x62, 0x9f, 0xcf, 0x0f, 0x8b, 0xb3, 0x42, 0xdf, 0x41, 0xac, 0x30, 0x41, 0xcf, 0xfe, 0x38, 0x08, - 0xff, 0x27, 0xd6, 0x35, 0x44, 0xf7, 0x70, 0x48, 0x91, 0xfe, 0x08, 0x12, 0xe7, 0x5d, 0xc9, 0x3c, - 0xc9, 0xed, 0x09, 0x8c, 0xf3, 0xe3, 0xaa, 0x49, 0xf6, 0x5d, 0xf6, 0xa6, 0xb2, 0xf5, 0x15, 0x28, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x4f, 0x13, 0x4f, + 0x14, 0x67, 0xe9, 0x97, 0x5f, 0xaf, 0xd0, 0xc0, 0x7e, 0x41, 0x97, 0x55, 0x16, 0xdc, 0x44, 0x42, + 0xaa, 0x74, 0xb5, 0x26, 0x68, 0xaa, 0x97, 0x42, 0x20, 0x31, 0x91, 0x4b, 0xc5, 0xc4, 0x78, 0x69, + 0x96, 0x76, 0xd8, 0x6d, 0x70, 0x77, 0x70, 0x66, 0x50, 0xbc, 0xa9, 0x47, 0x4f, 0x7a, 0xf6, 0x5f, + 0x30, 0x91, 0x03, 0x37, 0xff, 0x01, 0xbd, 0x11, 0x4e, 0x1e, 0x0d, 0x1c, 0xf8, 0x37, 0xcc, 0xce, + 0xec, 0x0c, 0xbb, 0xdb, 0x52, 0x9a, 0x5e, 0x16, 0xe6, 0x7d, 0xde, 0x7b, 0xf3, 0xf9, 0xbc, 0x79, + 0xef, 0x15, 0xa6, 0x5d, 0xb2, 0x8b, 0xb0, 0xd3, 0x78, 0xed, 0xb6, 0x02, 0x87, 0x1d, 0x94, 0xf6, + 0x08, 0x66, 0x58, 0xcf, 0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xa6, 0xbc, 0xf5, 0x15, 0x28, 0x20, 0xe6, 0x73, 0x3a, 0xd5, 0x00, 0xef, 0x87, 0x8c, 0xcb, 0xcb, 0xad, 0x16, 0x4e, 0x8e, 0x96, - 0x21, 0xde, 0xff, 0x34, 0x64, 0xb5, 0x4c, 0x96, 0x5e, 0x81, 0x49, 0x5e, 0x27, 0xb9, 0xf3, 0xbf, - 0x8e, 0x3b, 0xdb, 0xf2, 0xec, 0x37, 0x30, 0x21, 0x2d, 0xa8, 0x46, 0x58, 0x3f, 0x77, 0x56, 0xb9, - 0x9b, 0x35, 0xfd, 0x46, 0x67, 0xd3, 0xf9, 0x09, 0x36, 0x85, 0x99, 0x54, 0x40, 0xf9, 0x5e, 0x86, - 0x11, 0xb7, 0x47, 0xd3, 0x65, 0xa2, 0xbe, 0x08, 0xc3, 0xae, 0x50, 0x3c, 0xd8, 0x51, 0x71, 0x8c, - 0xda, 0x3f, 0x34, 0x98, 0xdc, 0xa4, 0xde, 0x16, 0x71, 0x43, 0xba, 0x83, 0x08, 0x3f, 0xbd, 0xaf, - 0xfe, 0x5c, 0x81, 0x31, 0xd6, 0xf3, 0xfd, 0x5e, 0xa4, 0x56, 0x9c, 0xac, 0x47, 0x56, 0x9b, 0x47, - 0x29, 0x72, 0xb6, 0x09, 0x46, 0x36, 0x26, 0x9d, 0xb2, 0x7f, 0x8b, 0x41, 0xab, 0x36, 0x9b, 0xfd, - 0x0b, 0x59, 0x82, 0xa1, 0x86, 0xef, 0xb6, 0x42, 0x2e, 0xa2, 0x50, 0xd6, 0x4b, 0x89, 0x67, 0xa4, - 0xb4, 0x16, 0x21, 0x35, 0x91, 0xa0, 0x1b, 0x17, 0xf7, 0x22, 0xe6, 0x4d, 0xb9, 0x7f, 0x4d, 0xb9, - 0xcf, 0xfb, 0x4d, 0xba, 0xdd, 0xcb, 0x14, 0x4a, 0xee, 0xf6, 0x0c, 0x1f, 0x42, 0xb9, 0x54, 0x12, - 0x7f, 0x6a, 0x30, 0x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x1a, 0x38, 0x3e, 0xb3, 0x06, 0xfe, 0x9c, 0x59, 0x03, + 0xaf, 0xee, 0x78, 0x2d, 0xe6, 0xef, 0x6f, 0x97, 0x1a, 0x38, 0x70, 0x78, 0xca, 0x10, 0xb1, 0x77, + 0x98, 0xec, 0x3a, 0xe9, 0x26, 0x64, 0xef, 0xf7, 0x10, 0xdd, 0x1e, 0xe6, 0xbf, 0xc4, 0x0f, 0xfe, + 0x05, 0x00, 0x00, 0xff, 0xff, 0x67, 0xa7, 0x7e, 0xa5, 0x2b, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used.