Skip to content

Commit

Permalink
chore: upstream latest changes (#21)
Browse files Browse the repository at this point in the history
This PR upstreams all changes made in the `noble-cctp-private-builds`,
used to create the `v4.0.0-beta1` tag.
  • Loading branch information
johnletey authored Sep 11, 2023
1 parent 22d212b commit 829029f
Show file tree
Hide file tree
Showing 47 changed files with 570 additions and 402 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
cosmossdk.io/errors v1.0.0-beta.7
cosmossdk.io/math v1.0.0-beta.4
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1
github.com/cosmos/btcutil v1.0.4
github.com/cosmos/cosmos-sdk v0.45.15
github.com/cosmos/ibc-go/v3 v3.4.0
github.com/ethereum/go-ethereum v1.12.0
Expand Down Expand Up @@ -75,7 +76,6 @@ require (
github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect
github.com/cometbft/cometbft-db v0.7.0 // indirect
github.com/confio/ics23/go v0.9.0 // indirect
github.com/cosmos/btcutil v1.0.4 // indirect
github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.1 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
Expand Down
40 changes: 20 additions & 20 deletions proto/circle/cctp/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,84 +37,84 @@ option go_package = "github.com/circlefin/noble-cctp/x/cctp/types";
service Query {
// Parameters queries the parameters of the module.
// rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
// option (google.api.http).get = "/noble/cctp/v1/params";
// option (google.api.http).get = "/circle/cctp/v1/params";
// }

rpc Roles(QueryRolesRequest) returns (QueryRolesResponse) {
option (google.api.http).get = "/noble/cctp/v1/roles";
option (google.api.http).get = "/circle/cctp/v1/roles";
}

// Queries an Attester by index
rpc Attester(QueryGetAttesterRequest) returns (QueryGetAttesterResponse) {
option (google.api.http).get = "/noble/cctp/v1/attesters/{attester}";
option (google.api.http).get = "/circle/cctp/v1/attesters/{attester}";
}
// Queries a list of Attesters
rpc Attesters(QueryAllAttestersRequest) returns (QueryAllAttestersResponse) {
option (google.api.http).get = "/noble/cctp/v1/attesters";
option (google.api.http).get = "/circle/cctp/v1/attesters";
}
// Queries a PerMessageBurnLimit by index
rpc PerMessageBurnLimit(QueryGetPerMessageBurnLimitRequest) returns (QueryGetPerMessageBurnLimitResponse) {
option (google.api.http).get = "/noble/cctp/v1/per_message_burn_limits/{denom}";
option (google.api.http).get = "/circle/cctp/v1/per_message_burn_limits/{denom}";
}
// Queries a list of PerMessageBurnLimits
rpc PerMessageBurnLimits(QueryAllPerMessageBurnLimitsRequest) returns (QueryAllPerMessageBurnLimitsResponse) {
option (google.api.http).get = "/noble/cctp/v1/per_message_burn_limits";
option (google.api.http).get = "/circle/cctp/v1/per_message_burn_limits";
}
// Queries BurningAndMintingPaused
rpc BurningAndMintingPaused(QueryGetBurningAndMintingPausedRequest) returns (QueryGetBurningAndMintingPausedResponse) {
option (google.api.http).get = "/noble/cctp/v1/burning_and_minting_paused";
option (google.api.http).get = "/circle/cctp/v1/burning_and_minting_paused";
}
// Queries SendingAndReceivingPaused
rpc SendingAndReceivingMessagesPaused(QueryGetSendingAndReceivingMessagesPausedRequest) returns (QueryGetSendingAndReceivingMessagesPausedResponse) {
option (google.api.http).get = "/noble/cctp/v1/sending_and_receiving_messages_paused";
option (google.api.http).get = "/circle/cctp/v1/sending_and_receiving_messages_paused";
}
// Queries the MaxMessageBodySize
rpc MaxMessageBodySize(QueryGetMaxMessageBodySizeRequest) returns (QueryGetMaxMessageBodySizeResponse) {
option (google.api.http).get = "/noble/cctp/v1/max_message_body_size";
option (google.api.http).get = "/circle/cctp/v1/max_message_body_size";
}
// Queries the NextAvailableNonce
rpc NextAvailableNonce(QueryGetNextAvailableNonceRequest) returns (QueryGetNextAvailableNonceResponse) {
option (google.api.http).get = "/noble/cctp/v1/next_available_nonce";
option (google.api.http).get = "/circle/cctp/v1/next_available_nonce";
}
// Queries the SignatureThreshold
rpc SignatureThreshold(QueryGetSignatureThresholdRequest) returns (QueryGetSignatureThresholdResponse) {
option (google.api.http).get = "/noble/cctp/v1/signature_threshold";
option (google.api.http).get = "/circle/cctp/v1/signature_threshold";
}
// Queries a TokenPair by index
rpc TokenPair(QueryGetTokenPairRequest) returns (QueryGetTokenPairResponse) {
option (google.api.http).get = "/noble/cctp/v1/token_pairs/{remote_domain}/{remote_token}";
option (google.api.http).get = "/circle/cctp/v1/token_pairs/{remote_domain}/{remote_token}";
}
// Queries a list of TokenPair
rpc TokenPairs(QueryAllTokenPairsRequest) returns (QueryAllTokenPairsResponse) {
option (google.api.http).get = "/noble/cctp/v1/token_pairs";
option (google.api.http).get = "/circle/cctp/v1/token_pairs";
}
// Queries a UsedNonce by index
rpc UsedNonce(QueryGetUsedNonceRequest) returns (QueryGetUsedNonceResponse) {
option (google.api.http).get = "/noble/cctp/v1/used_nonces/{nonce}";
option (google.api.http).get = "/circle/cctp/v1/used_nonces/{nonce}";
}
// Queries a list of UsedNonces
rpc UsedNonces(QueryAllUsedNoncesRequest) returns (QueryAllUsedNoncesResponse) {
option (google.api.http).get = "/noble/cctp/v1/used_nonces";
option (google.api.http).get = "/circle/cctp/v1/used_nonces";
}
// Query the RemoteTokenMessenger of a specific domain.
rpc RemoteTokenMessenger(QueryRemoteTokenMessengerRequest) returns (QueryRemoteTokenMessengerResponse) {
option (google.api.http).get = "/noble/cctp/v1/remote_token_messengers/{domain_id}";
option (google.api.http).get = "/circle/cctp/v1/remote_token_messengers/{domain_id}";
}
// Query all RemoteTokenMessenger's.
rpc RemoteTokenMessengers(QueryRemoteTokenMessengersRequest) returns (QueryRemoteTokenMessengersResponse) {
option (google.api.http).get = "/noble/cctp/v1/remote_token_messengers";
option (google.api.http).get = "/circle/cctp/v1/remote_token_messengers";
}

rpc BurnMessageVersion(QueryBurnMessageVersionRequest) returns (QueryBurnMessageVersionResponse) {
option (google.api.http).get = "/noble/cctp/v1/burn_message_version";
option (google.api.http).get = "/circle/cctp/v1/burn_message_version";
}

rpc LocalMessageVersion(QueryLocalMessageVersionRequest) returns (QueryLocalMessageVersionResponse) {
option (google.api.http).get = "/noble/cctp/v1/local_message_version";
option (google.api.http).get = "/circle/cctp/v1/local_message_version";
}

rpc LocalDomain(QueryLocalDomainRequest) returns (QueryLocalDomainResponse) {
option (google.api.http).get = "/noble/cctp/v1/local_domain";
option (google.api.http).get = "/circle/cctp/v1/local_domain";
}
}

Expand Down
4 changes: 2 additions & 2 deletions proto/circle/cctp/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ message MsgAcceptOwnerResponse {}

message MsgEnableAttester {
string from = 1;
bytes attester = 2;
string attester = 2;
}

message MsgEnableAttesterResponse {}

message MsgDisableAttester {
string from = 1;
bytes attester = 2;
string attester = 2;
}

message MsgDisableAttesterResponse {}
Expand Down
8 changes: 5 additions & 3 deletions x/cctp/client/cli/query_per_message_burn_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ func CmdListPerMessageBurnLimits() *cobra.Command {
func CmdShowPerMessageBurnLimit() *cobra.Command {
cmd := &cobra.Command{
Use: "show-per-message-burn-limit",
Short: "shows per message burn limit",
Args: cobra.NoArgs,
Short: "shows per message burn limit [denom]",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)

queryClient := types.NewQueryClient(clientCtx)

params := &types.QueryGetPerMessageBurnLimitRequest{}
params := &types.QueryGetPerMessageBurnLimitRequest{
Denom: args[0],
}

res, err := queryClient.PerMessageBurnLimit(context.Background(), params)
if err != nil {
Expand Down
8 changes: 5 additions & 3 deletions x/cctp/client/cli/tx_add_remote_token_messenger.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
package cli

import (
"fmt"
"strconv"

"github.com/circlefin/noble-cctp/x/cctp/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
)

Expand All @@ -37,8 +37,10 @@ func CmdAddRemoteTokenMessenger() *cobra.Command {
return err
}

address := make([]byte, 32)
copy(address[12:], common.FromHex(args[1]))
address, err := parseAddress(args[1])
if err != nil {
return fmt.Errorf("invalid address: %w", err)
}

clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand Down
8 changes: 5 additions & 3 deletions x/cctp/client/cli/tx_deposit_for_burn.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package cli

import (
"fmt"
"strconv"

"cosmossdk.io/math"
Expand All @@ -24,7 +25,6 @@ import (
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
)

Expand All @@ -44,8 +44,10 @@ func CmdDepositForBurn() *cobra.Command {
return err
}

mintRecipient := make([]byte, 32)
copy(mintRecipient[12:], common.FromHex(args[2]))
mintRecipient, err := parseAddress(args[2])
if err != nil {
return fmt.Errorf("invalid mint recipient: %w", err)
}

clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand Down
14 changes: 9 additions & 5 deletions x/cctp/client/cli/tx_deposit_for_burn_with_caller.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package cli

import (
"fmt"
"strconv"

"cosmossdk.io/math"
Expand All @@ -24,7 +25,6 @@ import (
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
)

Expand All @@ -44,11 +44,15 @@ func CmdDepositForBurnWithCaller() *cobra.Command {
return err
}

mintRecipient := make([]byte, 32)
copy(mintRecipient[12:], common.FromHex(args[2]))
mintRecipient, err := parseAddress(args[2])
if err != nil {
return fmt.Errorf("invalid mint recipient: %w", err)
}

destinationCaller := make([]byte, 32)
copy(destinationCaller[12:], common.FromHex(args[4]))
destinationCaller, err := parseAddress(args[4])
if err != nil {
return fmt.Errorf("invalid destination caller: %w", err)
}

clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion x/cctp/client/cli/tx_disable_attester.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func CmdDisableAttester() *cobra.Command {

msg := types.NewMsgDisableAttester(
clientCtx.GetFromAddress().String(),
[]byte(args[0]),
args[0],
)

return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
Expand Down
2 changes: 1 addition & 1 deletion x/cctp/client/cli/tx_enable_attester.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func CmdEnableAttester() *cobra.Command {

msg := types.NewMsgEnableAttester(
clientCtx.GetFromAddress().String(),
[]byte(args[0]),
args[0],
)

return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
Expand Down
8 changes: 5 additions & 3 deletions x/cctp/client/cli/tx_link_token_pair.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
package cli

import (
"fmt"
"strconv"

"github.com/circlefin/noble-cctp/x/cctp/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
)

Expand All @@ -32,8 +32,10 @@ func CmdLinkTokenPair() *cobra.Command {
Short: "Broadcast message link-token-pair",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) (err error) {
remoteToken := make([]byte, 32)
copy(remoteToken[12:], common.FromHex(args[1]))
remoteToken, err := parseAddress(args[1])
if err != nil {
return fmt.Errorf("invalid remote token: %w", err)
}

remoteDomain, err := strconv.ParseUint(args[2], types.BaseTen, types.DomainBitLen)
if err != nil {
Expand Down
8 changes: 5 additions & 3 deletions x/cctp/client/cli/tx_send_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
package cli

import (
"fmt"
"strconv"

"github.com/circlefin/noble-cctp/x/cctp/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
)

Expand All @@ -37,8 +37,10 @@ func CmdSendMessage() *cobra.Command {
return err
}

recipient := make([]byte, 32)
copy(recipient[12:], common.FromHex(args[1]))
recipient, err := parseAddress(args[1])
if err != nil {
return fmt.Errorf("invalid recipient: %w", err)
}

clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand Down
14 changes: 9 additions & 5 deletions x/cctp/client/cli/tx_send_message_with_caller.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
package cli

import (
"fmt"
"strconv"

"github.com/circlefin/noble-cctp/x/cctp/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
)

Expand All @@ -37,11 +37,15 @@ func CmdSendMessageWithCaller() *cobra.Command {
return err
}

recipient := make([]byte, 32)
copy(recipient[12:], common.FromHex(args[1]))
recipient, err := parseAddress(args[1])
if err != nil {
return fmt.Errorf("invalid recipient: %w", err)
}

destinationCaller := make([]byte, 32)
copy(destinationCaller[12:], common.FromHex(args[3]))
destinationCaller, err := parseAddress(args[3])
if err != nil {
return fmt.Errorf("invalid destination caller: %w", err)
}

clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand Down
10 changes: 6 additions & 4 deletions x/cctp/client/cli/tx_unlink_token_pair.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
package cli

import (
"fmt"
"strconv"

"github.com/circlefin/noble-cctp/x/cctp/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
)

Expand All @@ -32,14 +32,16 @@ func CmdUnlinkTokenPair() *cobra.Command {
Short: "Broadcast message unlink-token-pair",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) (err error) {
remoteToken, err := parseAddress(args[1])
if err != nil {
return fmt.Errorf("invalid remote token: %w", err)
}

remoteDomain, err := strconv.ParseUint(args[2], types.BaseTen, types.DomainBitLen)
if err != nil {
return err
}

remoteToken := make([]byte, 32)
copy(remoteToken[12:], common.FromHex(args[1]))

clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
Expand Down
Loading

0 comments on commit 829029f

Please sign in to comment.