diff --git a/contrib/images/ibcsim-bcd/setup-bcd.sh b/contrib/images/ibcsim-bcd/setup-bcd.sh index 63bb181..1901c3b 100755 --- a/contrib/images/ibcsim-bcd/setup-bcd.sh +++ b/contrib/images/ibcsim-bcd/setup-bcd.sh @@ -2,8 +2,8 @@ display_usage() { echo "Missing parameters. Please check if all parameters were specified." - echo "Usage: setup-bcd.sh [CHAIN_ID] [CHAIN_DIR] [RPC_PORT] [P2P_PORT] [PROFILING_PORT] [GRPC_PORT] [BABYLON_CONTRACT_CODE_FILE] [BTCSTAKING_CONTRACT_CODE_FILE] [BTCFINALITY_CONTRACT_CODE_FILE] [INSTANTIATING_CFG]" - echo "Example: setup-bcd.sh test-chain-id ./data 26657 26656 6060 9090 ./babylon_contract.wasm '{"btc_confirmation_depth":1,"checkpoint_finalization_timeout":2,"network":"Regtest","babylon_tag":"bbn0", "notify_cosmos_zone":false, "btc_staking_code_id":2}'" + echo "Usage: setup-bcd.sh [CHAIN_ID] [CHAIN_DIR] [RPC_PORT] [P2P_PORT] [PROFILING_PORT] [GRPC_PORT] [BABYLON_CONTRACT_CODE_FILE] [BTCSTAKING_CONTRACT_CODE_FILE] [BTCFINALITY_CONTRACT_CODE_FILE]" + echo "Example: setup-bcd.sh test-chain-id ./data 26657 26656 6060 9090 ./babylon_contract.wasm" exit 1 } @@ -35,7 +35,6 @@ GRPCPORT=$6 BABYLON_CONTRACT_CODE_FILE=$7 BTCSTAKING_CONTRACT_CODE_FILE=$8 BTCFINALITY_CONTRACT_CODE_FILE=$9 -INSTANTIATING_CFG=${10} # ensure the binary exists if ! command -v $BINARY &>/dev/null; then @@ -88,21 +87,6 @@ sed -i 's#"tcp://0.0.0.0:1317"#"tcp://0.0.0.0:1318"#g' $CHAINDIR/$CHAINID/config sed -i 's/"bond_denom": "stake"/"bond_denom": "'"$DENOM"'"/g' $CHAINDIR/$CHAINID/config/genesis.json # sed -i '' 's#index-events = \[\]#index-events = \["message.action","send_packet.packet_src_channel","send_packet.packet_sequence"\]#g' $CHAINDIR/$CHAINID/config/app.toml -## Script for getting contract addresses -## TODO(euphrates): pass a gov prop on setting the Babylon / BTC staking contract addresses -# babylonContractAddr=$(bcd query wasm list-contract-by-code 1 -o json | jq -r '.contracts[0]') -# btcStakingContractAddr=$(bcd query wasm list-contract-by-code 2 -o json | jq -r '.contracts[0]') -# echo "babylonContractAddr is $babylonContractAddr" -# echo "btcStakingContractAddr is $btcStakingContractAddr" - -# update contract address in genesis -babylonContractAddr=bbnc14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9syx25zf -btcStakingContractAddr=bbnc1nc5tatafv6eyq7llkr2gv50ff9e22mnf70qgjlv737ktmt4eswrqgn0kq0 -btcFinalityContractAddr=bbnc17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgssg3nft -sed -i 's/"babylon_contract_address": ""/"babylon_contract_address": "'"$babylonContractAddr"'"/g' $CHAINDIR/$CHAINID/config/genesis.json -sed -i 's/"btc_staking_contract_address": ""/"btc_staking_contract_address": "'"$btcStakingContractAddr"'"/g' $CHAINDIR/$CHAINID/config/genesis.json -sed -i 's/"btc_finality_contract_address": ""/"btc_finality_contract_address": "'"$btcFinalityContractAddr"'"/g' $CHAINDIR/$CHAINID/config/genesis.json - # Start echo "Starting $BINARY..." $BINARY --home $CHAINDIR/$CHAINID start --pruning=nothing --grpc-web.enable=false --grpc.address="0.0.0.0:$GRPCPORT" --log_level trace --trace --log_format 'plain' 2>&1 | tee $CHAINDIR/$CHAINID.log & @@ -125,4 +109,4 @@ sleep 10 # Echo the command with expanded variables echo "Instantiating contract $BABYLON_CONTRACT_CODE_FILE..." -$BINARY --home $CHAINDIR/$CHAINID tx wasm instantiate 1 "$INSTANTIATING_CFG" --admin=$(bcd --home $CHAINDIR/$CHAINID keys show user --keyring-backend test -a) --label "v0.0.1" $KEYRING --from user --chain-id $CHAINID --gas 20000000000 --gas-prices 0.001ustake --node http://localhost:$RPCPORT -y --amount 100000stake +$BINARY --home $CHAINDIR/$CHAINID tx babylon instantiate-babylon-contracts 1 2 3 "regtest" "01020304" 1 2 false "Test\ Consumer" "Test\ Consumer\ Description" "" --admin=$(bcd --home $CHAINDIR/$CHAINID keys show user --keyring-backend test -a) --label "v0.0.1" $KEYRING --from user --chain-id $CHAINID --gas 20000000000 --gas-prices 0.001ustake --node http://localhost:$RPCPORT -y --amount 100000stake diff --git a/contrib/images/ibcsim-bcd/wrapper.sh b/contrib/images/ibcsim-bcd/wrapper.sh index 2ebd636..23d19b9 100755 --- a/contrib/images/ibcsim-bcd/wrapper.sh +++ b/contrib/images/ibcsim-bcd/wrapper.sh @@ -7,17 +7,7 @@ CONSUMER_KEY="bcd-key" CONSUMER_CHAIN_ID="bcd-test" # 1. Create a bcd testnet with Babylon contract -./setup-bcd.sh $CONSUMER_CHAIN_ID $CONSUMER_CONF 26657 26656 6060 9090 ./babylon_contract.wasm ./btc_staking.wasm ./btc_finality.wasm '{ - "network": "regtest", - "babylon_tag": "01020304", - "btc_confirmation_depth": 1, - "checkpoint_finalization_timeout": 2, - "notify_cosmos_zone": false, - "btc_staking_code_id": 2, - "consumer_name": "Test Consumer", - "consumer_description": "Test Consumer Description", - "btc_finality_code_id": 3 -}' +./setup-bcd.sh $CONSUMER_CHAIN_ID $CONSUMER_CONF 26657 26656 6060 9090 ./babylon_contract.wasm ./btc_staking.wasm ./btc_finality.wasm sleep 10 diff --git a/demo/app/app.go b/demo/app/app.go index 4ded378..d39b49a 100644 --- a/demo/app/app.go +++ b/demo/app/app.go @@ -493,7 +493,9 @@ func NewConsumerApp( bbnkeeper.NewDefaultCustomMsgHandler(app.BabylonKeeper), ) }) - wasmOpts = append(wasmOpts, messageHandler, + wasmOpts = append(wasmOpts, + // add support for the custom message handlers + messageHandler, // add support for the custom queries wasmkeeper.WithQueryHandlerDecorator(bbnkeeper.NewQueryDecorator(app.BabylonKeeper)), ) diff --git a/demo/app/app_test.go b/demo/app/app_test.go index 58a4ddb..193f08e 100644 --- a/demo/app/app_test.go +++ b/demo/app/app_test.go @@ -1,8 +1,8 @@ package app import ( - "encoding/json" "fmt" + "strconv" "testing" "time" @@ -10,6 +10,7 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + "github.com/babylonlabs-io/babylon-sdk/x/babylon/client/cli" babylonkeeper "github.com/babylonlabs-io/babylon-sdk/x/babylon/keeper" "github.com/babylonlabs-io/babylon-sdk/x/babylon/types" abci "github.com/cometbft/cometbft/abci/types" @@ -122,34 +123,36 @@ func TestInstantiateBabylonContracts(t *testing.T) { btcFinalityContractCodeID := resp.CodeID require.NoError(t, err) - // BTC staking init message - btcStakingInitMsg := map[string]interface{}{ - "admin": consumerApp.BabylonKeeper.GetAuthority(), - } - btcStakingInitMsgBytes, err := json.Marshal(btcStakingInitMsg) - require.NoError(t, err) - // BTC finality init message - btcFinalityInitMsg := map[string]interface{}{ - "admin": consumerApp.BabylonKeeper.GetAuthority(), - } - btcFinalityInitMsgBytes, err := json.Marshal(btcFinalityInitMsg) + msg, err := cli.ParseInstantiateArgs([]string{ + strconv.FormatUint(babylonContractCodeID, 10), + strconv.FormatUint(btcStakingContractCodeID, 10), + strconv.FormatUint(btcFinalityContractCodeID, 10), + "regtest", + "01020304", + "1", + "2", + "false", + "test-consumer", + "test-consumer-description", + consumerApp.BabylonKeeper.GetAuthority(), + }, consumerApp.BabylonKeeper.GetAuthority()) require.NoError(t, err) // instantiate Babylon contract - _, err = babylonMsgServer.InstantiateBabylonContracts(ctx, &types.MsgInstantiateBabylonContracts{ - Network: "regtest", - BabylonContractCodeId: babylonContractCodeID, - BtcStakingContractCodeId: btcStakingContractCodeID, - BtcFinalityContractCodeId: btcFinalityContractCodeID, - BabylonTag: "01020304", - BtcConfirmationDepth: 1, - CheckpointFinalizationTimeout: 2, - NotifyCosmosZone: false, - BtcStakingMsg: btcStakingInitMsgBytes, - BtcFinalityMsg: btcFinalityInitMsgBytes, - ConsumerName: "test-consumer", - ConsumerDescription: "test-consumer-description", - Admin: babylonKeeper.GetAuthority(), - }) + _, err = babylonMsgServer.InstantiateBabylonContracts(ctx, msg) + require.NoError(t, err) + + // get params and verify contract addresses are set correctly + params := babylonKeeper.GetParams(ctx) + require.NotEmpty(t, params.BabylonContractAddress) + require.NotEmpty(t, params.BtcStakingContractAddress) + require.NotEmpty(t, params.BtcFinalityContractAddress) + + // verify addresses are valid + _, err = sdk.AccAddressFromBech32(params.BabylonContractAddress) + require.NoError(t, err) + _, err = sdk.AccAddressFromBech32(params.BtcStakingContractAddress) + require.NoError(t, err) + _, err = sdk.AccAddressFromBech32(params.BtcFinalityContractAddress) require.NoError(t, err) } diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index 00ff66d..4741356 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -174,8 +174,6 @@ type. | `btc_confirmation_depth` | [uint32](#uint32) | | btc_confirmation_depth is the number of confirmations required for Bitcoin transactions | | `checkpoint_finalization_timeout` | [uint32](#uint32) | | checkpoint_finalization_timeout is the timeout in blocks for checkpoint finalization | | `notify_cosmos_zone` | [bool](#bool) | | notify_cosmos_zone indicates whether to notify the Cosmos zone of events | -| `btc_staking_msg` | [bytes](#bytes) | | btc_staking_msg is the initialization message for the BTC staking contract | -| `btc_finality_msg` | [bytes](#bytes) | | btc_finality_msg is the initialization message for the BTC finality contract | | `consumer_name` | [string](#string) | | consumer_name is the name of this consumer chain | | `consumer_description` | [string](#string) | | consumer_description is a description of this consumer chain | | `admin` | [string](#string) | | admin is the address that controls the Babylon module | diff --git a/proto/babylonlabs/babylon/v1beta1/tx.proto b/proto/babylonlabs/babylon/v1beta1/tx.proto index af2ca6d..d87c46c 100644 --- a/proto/babylonlabs/babylon/v1beta1/tx.proto +++ b/proto/babylonlabs/babylon/v1beta1/tx.proto @@ -51,17 +51,12 @@ message MsgInstantiateBabylonContracts { uint32 checkpoint_finalization_timeout = 8; // notify_cosmos_zone indicates whether to notify the Cosmos zone of events bool notify_cosmos_zone = 9; - // btc_staking_msg is the initialization message for the BTC staking contract - bytes btc_staking_msg = 10; - // btc_finality_msg is the initialization message for the BTC finality - // contract - bytes btc_finality_msg = 11; // consumer_name is the name of this consumer chain - string consumer_name = 12; + string consumer_name = 10; // consumer_description is a description of this consumer chain - string consumer_description = 13; + string consumer_description = 11; // admin is the address that controls the Babylon module - string admin = 14 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string admin = 12 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgInstantiateBabylonContractsResponse is the Msg/InstantiateBabylonContracts diff --git a/tests/e2e/local_e2e_test.go b/tests/e2e/local_e2e_test.go index 8475560..a711bee 100644 --- a/tests/e2e/local_e2e_test.go +++ b/tests/e2e/local_e2e_test.go @@ -8,7 +8,6 @@ import ( "github.com/babylonlabs-io/babylon-sdk/demo/app" appparams "github.com/babylonlabs-io/babylon-sdk/demo/app/params" "github.com/babylonlabs-io/babylon-sdk/tests/e2e/types" - bbntypes "github.com/babylonlabs-io/babylon-sdk/x/babylon/types" sdk "github.com/cosmos/cosmos-sdk/types" ibctesting2 "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/suite" @@ -97,28 +96,11 @@ func (s *BabylonSDKTestSuite) Test1ContractDeployment() { s.NoError(err) s.Equal(adminRespFinality["admin"], s.ConsumerCli.GetSender().String()) - // get contract addresses - babylonContractAddress := s.ConsumerContract.Babylon.String() - btcStakingContractAddress := s.ConsumerContract.BTCStaking.String() - btcFinalityContractAddress := s.ConsumerContract.BTCFinality.String() - - // update the contract address in parameters - msgUpdateParams := &bbntypes.MsgUpdateParams{ - Authority: s.ConsumerApp.BabylonKeeper.GetAuthority(), - Params: bbntypes.Params{ - MaxGasBeginBlocker: 500_000, - BabylonContractAddress: babylonContractAddress, - BtcStakingContractAddress: btcStakingContractAddress, - BtcFinalityContractAddress: btcFinalityContractAddress, - }, - } - s.ConsumerCli.MustExecGovProposal(msgUpdateParams) - // assert the contract addresses are updated params := s.ConsumerApp.BabylonKeeper.GetParams(s.ConsumerChain.GetContext()) - s.Equal(babylonContractAddress, params.BabylonContractAddress) - s.Equal(btcStakingContractAddress, params.BtcStakingContractAddress) - s.Equal(btcFinalityContractAddress, params.BtcFinalityContractAddress) + s.Equal(s.ConsumerContract.Babylon.String(), params.BabylonContractAddress) + s.Equal(s.ConsumerContract.BTCStaking.String(), params.BtcStakingContractAddress) + s.Equal(s.ConsumerContract.BTCFinality.String(), params.BtcFinalityContractAddress) } func (s *BabylonSDKTestSuite) Test2MockConsumerFpDelegation() { diff --git a/tests/e2e/types/test_client.go b/tests/e2e/types/test_client.go index 420d6dd..c9a20ec 100644 --- a/tests/e2e/types/test_client.go +++ b/tests/e2e/types/test_client.go @@ -1,13 +1,14 @@ package types import ( - "encoding/json" "fmt" + "strconv" "testing" "github.com/CosmWasm/wasmd/x/wasm/ibctesting" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" "github.com/babylonlabs-io/babylon-sdk/demo/app" + "github.com/babylonlabs-io/babylon-sdk/x/babylon/client/cli" bbntypes "github.com/babylonlabs-io/babylon-sdk/x/babylon/types" abci "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -104,41 +105,25 @@ func (p *TestConsumerClient) BootstrapContracts() (*ConsumerContract, error) { btcStakingContractWasmId := p.Chain.StoreCodeFile("../testdata/btc_staking.wasm").CodeID btcFinalityContractWasmId := p.Chain.StoreCodeFile("../testdata/btc_finality.wasm").CodeID - // Instantiate the contract - // TODO: parameterise - btcStakingInitMsg := map[string]interface{}{ - "admin": p.GetSender().String(), - } - btcStakingInitMsgBytes, err := json.Marshal(btcStakingInitMsg) - if err != nil { - return nil, err - } - btcFinalityInitMsg := map[string]interface{}{ - "admin": p.GetSender().String(), - } - btcFinalityInitMsgBytes, err := json.Marshal(btcFinalityInitMsg) + // instantiate Babylon contracts + msgInstantiate, err := cli.ParseInstantiateArgs([]string{ + strconv.FormatUint(babylonContractWasmId, 10), + strconv.FormatUint(btcStakingContractWasmId, 10), + strconv.FormatUint(btcFinalityContractWasmId, 10), + "regtest", + "01020304", + "1", + "2", + "false", + "test-consumer", + "test-consumer-description", + p.GetSender().String(), + }, p.GetSender().String()) if err != nil { return nil, err } - // instantiate Babylon contract - msgInstantiate := bbntypes.MsgInstantiateBabylonContracts{ - Signer: p.GetSender().String(), - BabylonContractCodeId: babylonContractWasmId, - BtcStakingContractCodeId: btcStakingContractWasmId, - BtcFinalityContractCodeId: btcFinalityContractWasmId, - Network: "regtest", - BabylonTag: "01020304", - BtcConfirmationDepth: 1, - CheckpointFinalizationTimeout: 2, - NotifyCosmosZone: false, - BtcStakingMsg: btcStakingInitMsgBytes, - BtcFinalityMsg: btcFinalityInitMsgBytes, - ConsumerName: "test-consumer", - ConsumerDescription: "test-consumer-description", - Admin: p.GetSender().String(), - } - _, err = p.Chain.SendMsgs(&msgInstantiate) + _, err = p.Chain.SendMsgs(msgInstantiate) if err != nil { return nil, err } diff --git a/tests/testdata/babylon_contract.wasm b/tests/testdata/babylon_contract.wasm index 8420796..f49fcd1 100644 Binary files a/tests/testdata/babylon_contract.wasm and b/tests/testdata/babylon_contract.wasm differ diff --git a/tests/testdata/btc_finality.wasm b/tests/testdata/btc_finality.wasm index 1266820..a3baebc 100644 Binary files a/tests/testdata/btc_finality.wasm and b/tests/testdata/btc_finality.wasm differ diff --git a/tests/testdata/btc_staking.wasm b/tests/testdata/btc_staking.wasm index 873274e..113cfb3 100644 Binary files a/tests/testdata/btc_staking.wasm and b/tests/testdata/btc_staking.wasm differ diff --git a/tests/testdata/version.txt b/tests/testdata/version.txt index c08d334..0607340 100644 --- a/tests/testdata/version.txt +++ b/tests/testdata/version.txt @@ -1 +1 @@ -84130eb706e1fb60e16cecf9ce8ade94b66ffa62 +f71162b0dd42190387be3f911413e5f3e6513f09 diff --git a/x/babylon/client/cli/tx.go b/x/babylon/client/cli/tx.go index 50a542f..741b76e 100644 --- a/x/babylon/client/cli/tx.go +++ b/x/babylon/client/cli/tx.go @@ -1,7 +1,6 @@ package cli import ( - "encoding/hex" "strconv" "github.com/cosmos/cosmos-sdk/client" @@ -30,8 +29,8 @@ func GetTxCmd() *cobra.Command { return txCmd } -// [babylon-contract-code-id] [btc-staking-contract-code-id] [btc-finality-contract-code-id] [btc-network] [babylon-tag] [btc-confirmation-depth] [checkpoint-finalization-timeout] [notify-cosmos-zone] [btc-staking-init-msg-hex] [btc-finality-init-msg-hex] [consumer-name] [consumer-description] [admin] -func parseInstantiateArgs(args []string, sender string) (*types.MsgInstantiateBabylonContracts, error) { +// [babylon-contract-code-id] [btc-staking-contract-code-id] [btc-finality-contract-code-id] [btc-network] [babylon-tag] [btc-confirmation-depth] [checkpoint-finalization-timeout] [notify-cosmos-zone] [consumer-name] [consumer-description] [admin] +func ParseInstantiateArgs(args []string, sender string) (*types.MsgInstantiateBabylonContracts, error) { // get the id of the code to instantiate babylonContractCodeID, err := strconv.ParseUint(args[0], 10, 64) if err != nil { @@ -60,17 +59,9 @@ func parseInstantiateArgs(args []string, sender string) (*types.MsgInstantiateBa if err != nil { return nil, err } - btcStakingInitMsg, err := hex.DecodeString(args[8]) - if err != nil { - return nil, err - } - btcFinalityInitMsg, err := hex.DecodeString(args[9]) - if err != nil { - return nil, err - } - consumerName := args[10] - consumerDescription := args[11] - adminStr := args[12] + consumerName := args[8] + consumerDescription := args[9] + adminStr := args[10] // build and sign the transaction, then broadcast to Tendermint msg := types.MsgInstantiateBabylonContracts{ @@ -83,8 +74,6 @@ func parseInstantiateArgs(args []string, sender string) (*types.MsgInstantiateBa BtcConfirmationDepth: uint32(btcConfirmationDepth), CheckpointFinalizationTimeout: uint32(checkpointFinalizationTimeout), NotifyCosmosZone: notifyCosmosZone, - BtcStakingMsg: btcStakingInitMsg, - BtcFinalityMsg: btcFinalityInitMsg, ConsumerName: consumerName, ConsumerDescription: consumerDescription, Admin: adminStr, @@ -94,7 +83,7 @@ func parseInstantiateArgs(args []string, sender string) (*types.MsgInstantiateBa func NewInstantiateBabylonContractsCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "instantiate-babylon-contracts [babylon-contract-code-id] [btc-staking-contract-code-id] [btc-finality-contract-code-id] [btc-network] [babylon-tag] [btc-confirmation-depth] [checkpoint-finalization-timeout] [notify-cosmos-zone] [btc-staking-init-msg-hex] [btc-finality-init-msg-hex] [consumer-name] [consumer-description] [admin]", + Use: "instantiate-babylon-contracts [babylon-contract-code-id] [btc-staking-contract-code-id] [btc-finality-contract-code-id] [btc-network] [babylon-tag] [btc-confirmation-depth] [checkpoint-finalization-timeout] [notify-cosmos-zone] [consumer-name] [consumer-description] [admin]", Short: "Instantiate Babylon contracts", Long: "Instantiate Babylon contracts", Aliases: []string{"i"}, @@ -104,7 +93,7 @@ func NewInstantiateBabylonContractsCmd() *cobra.Command { if err != nil { return err } - msg, err := parseInstantiateArgs(args, clientCtx.GetFromAddress().String()) + msg, err := ParseInstantiateArgs(args, clientCtx.GetFromAddress().String()) if err != nil { return err } diff --git a/x/babylon/contract/query.go b/x/babylon/contract/query.go index d94e204..f6918a8 100644 --- a/x/babylon/contract/query.go +++ b/x/babylon/contract/query.go @@ -1,16 +1,20 @@ package contract // CustomQuery is a query request from a smart contract to the Babylon module -// TODO: implement type CustomQuery struct { - Test *TestQuery `json:"test,omitempty"` + Params *ParamsQuery `json:"params,omitempty"` } -type TestQuery struct { - Placeholder string `json:"placeholder,omitempty"` -} +// ParamsQuery requests the current module parameters +type ParamsQuery struct{} -type TestResponse struct { - // MaxCap is the max cap limit - Placeholder2 string `json:"placeholder2"` +// ParamsResponse contains the current module parameters +type ParamsResponse struct { + BabylonContractCodeId uint64 `json:"babylon_contract_code_id,omitempty"` + BtcStakingContractCodeId uint64 `json:"btc_staking_contract_code_id,omitempty"` + BtcFinalityContractCodeId uint64 `json:"btc_finality_contract_code_id,omitempty"` + BabylonContractAddress string `json:"babylon_contract_address,omitempty"` + BtcStakingContractAddress string `json:"btc_staking_contract_address,omitempty"` + BtcFinalityContractAddress string `json:"btc_finality_contract_address,omitempty"` + MaxGasBeginBlocker uint32 `json:"max_gas_begin_blocker,omitempty"` } diff --git a/x/babylon/keeper/msg_server.go b/x/babylon/keeper/msg_server.go index 6b2d81f..d6e2cb8 100644 --- a/x/babylon/keeper/msg_server.go +++ b/x/babylon/keeper/msg_server.go @@ -31,16 +31,12 @@ func (ms msgServer) InstantiateBabylonContracts(goCtx context.Context, req *type } // construct the init message - initMsg, err := types.NewInitMsg( + babylonInitMsg, err := types.NewInitMsg( req.Network, req.BabylonTag, req.BtcConfirmationDepth, req.CheckpointFinalizationTimeout, req.NotifyCosmosZone, - req.BtcStakingContractCodeId, - req.BtcStakingMsg, - req.BtcFinalityContractCodeId, - req.BtcFinalityMsg, req.ConsumerName, req.ConsumerDescription, req.Admin, @@ -48,9 +44,17 @@ func (ms msgServer) InstantiateBabylonContracts(goCtx context.Context, req *type if err != nil { return nil, err } + btcStakingInitMsg, err := types.NewBTCStakingInitMsg(req.Admin) + if err != nil { + return nil, err + } + btcFinalityInitMsg, err := types.NewBTCFinalityInitMsg(req.Admin) + if err != nil { + return nil, err + } // instantiate the contracts - babylonContractAddr, btcStakingContractAddr, btcFinalityContractAddr, err := ms.k.InstantiateBabylonContracts(ctx, req.BabylonContractCodeId, initMsg) + babylonContractAddr, btcStakingContractAddr, btcFinalityContractAddr, err := ms.k.InstantiateBabylonContracts(ctx, req.BabylonContractCodeId, req.BtcStakingContractCodeId, req.BtcFinalityContractCodeId, babylonInitMsg, btcStakingInitMsg, btcFinalityInitMsg) if err != nil { return nil, err } diff --git a/x/babylon/keeper/query_plugin.go b/x/babylon/keeper/query_plugin.go index 74b9292..5c4cd22 100644 --- a/x/babylon/keeper/query_plugin.go +++ b/x/babylon/keeper/query_plugin.go @@ -10,12 +10,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/babylonlabs-io/babylon-sdk/x/babylon/contract" + "github.com/babylonlabs-io/babylon-sdk/x/babylon/types" ) type ( // abstract query keeper ViewKeeper interface { - GetTest(ctx sdk.Context, actor sdk.AccAddress) string + GetParams(ctx sdk.Context) types.Params } ) @@ -52,15 +53,22 @@ func ChainedCustomQuerier(k ViewKeeper, next wasmkeeper.WasmVMQueryHandler) wasm if err := json.Unmarshal(request.Custom, &contractQuery); err != nil { return nil, errorsmod.Wrap(err, "babylon query") } - query := contractQuery.Test - if query == nil { + switch { + case contractQuery.Params != nil: + params := k.GetParams(ctx) + res := contract.ParamsResponse{ + BabylonContractCodeId: params.BabylonContractCodeId, + BtcStakingContractCodeId: params.BtcStakingContractCodeId, + BtcFinalityContractCodeId: params.BtcFinalityContractCodeId, + BabylonContractAddress: params.BabylonContractAddress, + BtcStakingContractAddress: params.BtcStakingContractAddress, + BtcFinalityContractAddress: params.BtcFinalityContractAddress, + MaxGasBeginBlocker: params.MaxGasBeginBlocker, + } + return json.Marshal(res) + default: return next.HandleQuery(ctx, caller, request) } - - res := contract.TestResponse{ - Placeholder2: "hello world", - } - return json.Marshal(res) }) } diff --git a/x/babylon/keeper/query_plugin_test.go b/x/babylon/keeper/query_plugin_test.go index 32fe9ec..2774a38 100644 --- a/x/babylon/keeper/query_plugin_test.go +++ b/x/babylon/keeper/query_plugin_test.go @@ -1,10 +1,13 @@ package keeper_test import ( + "encoding/json" "testing" wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + "github.com/babylonlabs-io/babylon-sdk/x/babylon/contract" "github.com/babylonlabs-io/babylon-sdk/x/babylon/keeper" + "github.com/babylonlabs-io/babylon-sdk/x/babylon/types" "github.com/cometbft/cometbft/libs/rand" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -16,6 +19,18 @@ func TestChainedCustomQuerier(t *testing.T) { myContractAddr := sdk.AccAddress(rand.Bytes(32)) keepers := NewTestKeepers(t) + defaultParams := contract.ParamsResponse{ + BabylonContractCodeId: 0, + BtcStakingContractCodeId: 0, + BtcFinalityContractCodeId: 0, + BabylonContractAddress: "", + BtcStakingContractAddress: "", + BtcFinalityContractAddress: "", + MaxGasBeginBlocker: 500_000, + } + expData, err := json.Marshal(defaultParams) + require.NoError(t, err) + specs := map[string]struct { src wasmvmtypes.QueryRequest viewKeeper keeper.ViewKeeper @@ -30,13 +45,21 @@ func TestChainedCustomQuerier(t *testing.T) { viewKeeper: keepers.BabylonKeeper, expNextCalled: true, }, - "custom non babylon query": { + "unexpected babylon query": { src: wasmvmtypes.QueryRequest{ Custom: []byte(`{"foo":{}}`), }, viewKeeper: keepers.BabylonKeeper, expNextCalled: true, }, + "expected babylon query": { + src: wasmvmtypes.QueryRequest{ + Custom: []byte(`{"params":{}}`), + }, + viewKeeper: keepers.BabylonKeeper, + expNextCalled: false, + expData: expData, + }, } for name, spec := range specs { t.Run(name, func(t *testing.T) { @@ -62,12 +85,12 @@ func TestChainedCustomQuerier(t *testing.T) { var _ keeper.ViewKeeper = &MockViewKeeper{} type MockViewKeeper struct { - GetTestFn func(ctx sdk.Context, actor sdk.AccAddress) string + GetParamsFn func(ctx sdk.Context) types.Params } -func (m MockViewKeeper) GetTest(ctx sdk.Context, actor sdk.AccAddress) string { - if m.GetTestFn == nil { +func (m MockViewKeeper) GetParams(ctx sdk.Context) types.Params { + if m.GetParamsFn == nil { panic("not expected to be called") } - return m.GetTestFn(ctx, actor) + return m.GetParamsFn(ctx) } diff --git a/x/babylon/keeper/wasm.go b/x/babylon/keeper/wasm.go index 0bc4af1..f24a4f4 100644 --- a/x/babylon/keeper/wasm.go +++ b/x/babylon/keeper/wasm.go @@ -9,14 +9,17 @@ import ( errorsmod "cosmossdk.io/errors" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/babylonlabs-io/babylon-sdk/x/babylon/contract" - types "github.com/babylonlabs-io/babylon-sdk/x/babylon/types" sdk "github.com/cosmos/cosmos-sdk/types" ) func (k Keeper) InstantiateBabylonContracts( ctx sdk.Context, babylonContractCodeId uint64, - initMsg []byte, + btcStakingContractCodeId uint64, + btcFinalityContractCodeId uint64, + babylonInitMsg []byte, + btcStakingInitMsg []byte, + btcFinalityInitMsg []byte, ) (string, string, string, error) { contractKeeper := wasmkeeper.NewGovPermissionKeeper(k.wasm) @@ -27,30 +30,24 @@ func (k Keeper) InstantiateBabylonContracts( } // instantiate Babylon contract - babylonContractAddr, _, err := contractKeeper.Instantiate(ctx, babylonContractCodeId, govAddr, govAddr, initMsg, "Babylon contract", nil) + babylonContractAddr, _, err := contractKeeper.Instantiate(ctx, babylonContractCodeId, govAddr, govAddr, babylonInitMsg, "Babylon contract", nil) if err != nil { return "", "", "", err } - // get contract addresses - configQuery := []byte(`{"config":{}}`) - res, err := k.wasm.QuerySmart(ctx, babylonContractAddr, configQuery) + // instantiate BTC staking contract + btcStakingContractAddr, _, err := contractKeeper.Instantiate(ctx, btcStakingContractCodeId, govAddr, govAddr, btcStakingInitMsg, "BTC staking contract", nil) if err != nil { return "", "", "", err } - var config types.BabylonContractConfig - err = json.Unmarshal(res, &config) + + // instantiate BTC finality contract + btcFinalityContractAddr, _, err := contractKeeper.Instantiate(ctx, btcFinalityContractCodeId, govAddr, govAddr, btcFinalityInitMsg, "BTC finality contract", nil) if err != nil { return "", "", "", err } - if len(config.BTCStaking) == 0 { - return "", "", "", errorsmod.Wrap(types.ErrInvalid, "failed to instantiate BTC staking contract") - } - if len(config.BTCFinality) == 0 { - return "", "", "", errorsmod.Wrap(types.ErrInvalid, "failed to instantiate BTC finality contract") - } - return babylonContractAddr.String(), config.BTCStaking, config.BTCFinality, nil + return babylonContractAddr.String(), btcStakingContractAddr.String(), btcFinalityContractAddr.String(), nil } func (k Keeper) getBTCStakingContractAddr(ctx sdk.Context) sdk.AccAddress { diff --git a/x/babylon/types/babylon.go b/x/babylon/types/babylon.go index 38de66f..8483138 100644 --- a/x/babylon/types/babylon.go +++ b/x/babylon/types/babylon.go @@ -29,10 +29,6 @@ func NewInitMsg( btcConfirmationDepth uint32, checkpointFinalizationTimeout uint32, notifyCosmosZone bool, - btcStakingCodeId uint64, - btcStakingInitMsgBytes []byte, - btcFinalityCodeId uint64, - btcFinalityInitMsgBytes []byte, consumerName string, consumerDescription string, admin string, @@ -43,12 +39,8 @@ func NewInitMsg( "btc_confirmation_depth": btcConfirmationDepth, "checkpoint_finalization_timeout": checkpointFinalizationTimeout, "notify_cosmos_zone": notifyCosmosZone, - "btc_staking_code_id": btcStakingCodeId, - "btc_staking_msg": btcStakingInitMsgBytes, "consumer_name": consumerName, "consumer_description": consumerDescription, - "btc_finality_code_id": btcFinalityCodeId, - "btc_finality_msg": btcFinalityInitMsgBytes, "admin": admin, } initMsgBytes, err := json.Marshal(initMsg) @@ -57,3 +49,17 @@ func NewInitMsg( } return initMsgBytes, nil } + +func NewBTCStakingInitMsg(admin string) ([]byte, error) { + initMsg := map[string]interface{}{ + "admin": admin, + } + return json.Marshal(initMsg) +} + +func NewBTCFinalityInitMsg(admin string) ([]byte, error) { + initMsg := map[string]interface{}{ + "admin": admin, + } + return json.Marshal(initMsg) +} diff --git a/x/babylon/types/tx.pb.go b/x/babylon/types/tx.pb.go index a8507c5..f0f8415 100644 --- a/x/babylon/types/tx.pb.go +++ b/x/babylon/types/tx.pb.go @@ -54,17 +54,12 @@ type MsgInstantiateBabylonContracts struct { CheckpointFinalizationTimeout uint32 `protobuf:"varint,8,opt,name=checkpoint_finalization_timeout,json=checkpointFinalizationTimeout,proto3" json:"checkpoint_finalization_timeout,omitempty"` // notify_cosmos_zone indicates whether to notify the Cosmos zone of events NotifyCosmosZone bool `protobuf:"varint,9,opt,name=notify_cosmos_zone,json=notifyCosmosZone,proto3" json:"notify_cosmos_zone,omitempty"` - // btc_staking_msg is the initialization message for the BTC staking contract - BtcStakingMsg []byte `protobuf:"bytes,10,opt,name=btc_staking_msg,json=btcStakingMsg,proto3" json:"btc_staking_msg,omitempty"` - // btc_finality_msg is the initialization message for the BTC finality - // contract - BtcFinalityMsg []byte `protobuf:"bytes,11,opt,name=btc_finality_msg,json=btcFinalityMsg,proto3" json:"btc_finality_msg,omitempty"` // consumer_name is the name of this consumer chain - ConsumerName string `protobuf:"bytes,12,opt,name=consumer_name,json=consumerName,proto3" json:"consumer_name,omitempty"` + ConsumerName string `protobuf:"bytes,10,opt,name=consumer_name,json=consumerName,proto3" json:"consumer_name,omitempty"` // consumer_description is a description of this consumer chain - ConsumerDescription string `protobuf:"bytes,13,opt,name=consumer_description,json=consumerDescription,proto3" json:"consumer_description,omitempty"` + ConsumerDescription string `protobuf:"bytes,11,opt,name=consumer_description,json=consumerDescription,proto3" json:"consumer_description,omitempty"` // admin is the address that controls the Babylon module - Admin string `protobuf:"bytes,14,opt,name=admin,proto3" json:"admin,omitempty"` + Admin string `protobuf:"bytes,12,opt,name=admin,proto3" json:"admin,omitempty"` } func (m *MsgInstantiateBabylonContracts) Reset() { *m = MsgInstantiateBabylonContracts{} } @@ -234,52 +229,50 @@ func init() { } var fileDescriptor_406c9f025b2f9448 = []byte{ - // 716 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0x4f, 0x4b, 0x1b, 0x4d, - 0x1c, 0xc7, 0xb3, 0x6a, 0xa2, 0x4e, 0x12, 0x95, 0x79, 0xf2, 0x3c, 0x8e, 0xf1, 0x71, 0x0d, 0xb1, - 0x48, 0x2a, 0x9a, 0x6d, 0xac, 0x6d, 0xc1, 0x42, 0xa9, 0x89, 0x08, 0x1e, 0x2c, 0x65, 0xb5, 0x17, - 0x2f, 0x61, 0x76, 0x77, 0xdc, 0x0c, 0x71, 0x67, 0x96, 0x9d, 0x89, 0x35, 0x9e, 0x4a, 0x5f, 0x41, - 0x5f, 0x40, 0xa1, 0xd0, 0x57, 0xe0, 0xa1, 0x2f, 0xc2, 0xa3, 0xf4, 0x54, 0x28, 0x94, 0x56, 0x0f, - 0xbe, 0x8d, 0xb2, 0xbb, 0xb3, 0x26, 0x2a, 0x44, 0x4a, 0x4f, 0x99, 0xd9, 0xef, 0xe7, 0xfb, 0xfb, - 0x97, 0xdf, 0x2e, 0x78, 0x60, 0x61, 0xab, 0x7b, 0xc8, 0xd9, 0x21, 0xb6, 0x84, 0xa1, 0xce, 0xc6, - 0x51, 0xcd, 0x22, 0x12, 0xd7, 0x0c, 0x79, 0x5c, 0xf5, 0x03, 0x2e, 0x39, 0x9c, 0xed, 0xa3, 0xaa, - 0xea, 0x5c, 0x55, 0x54, 0xb1, 0xe0, 0x72, 0x97, 0x47, 0x9c, 0x11, 0x9e, 0x62, 0x4b, 0x71, 0xda, - 0xe6, 0xc2, 0xe3, 0xc2, 0xf0, 0x84, 0x6b, 0x1c, 0xd5, 0xc2, 0x1f, 0x25, 0xcc, 0xc4, 0x42, 0x33, - 0x76, 0xc4, 0x17, 0x25, 0x3d, 0x1c, 0x54, 0x4c, 0x92, 0x36, 0x42, 0xcb, 0xdf, 0xd3, 0x40, 0xdf, - 0x11, 0xee, 0x36, 0x13, 0x12, 0x33, 0x49, 0xb1, 0x24, 0xf5, 0x58, 0x6f, 0x70, 0x26, 0x03, 0x6c, - 0x4b, 0x01, 0x1f, 0x81, 0x8c, 0xa0, 0x2e, 0x23, 0x01, 0xd2, 0x4a, 0x5a, 0x65, 0xbc, 0x8e, 0xbe, - 0x7e, 0x59, 0x29, 0xa8, 0x7c, 0x1b, 0x8e, 0x13, 0x10, 0x21, 0x76, 0x65, 0x40, 0x99, 0x6b, 0x2a, - 0x0e, 0x3e, 0x03, 0x48, 0x65, 0x69, 0xda, 0x2a, 0x4c, 0xd3, 0xe6, 0x0e, 0x69, 0x52, 0x07, 0x0d, - 0x95, 0xb4, 0xca, 0x88, 0xf9, 0xaf, 0x75, 0x33, 0x4b, 0x83, 0x3b, 0x64, 0xdb, 0x81, 0x2f, 0xc0, - 0xff, 0x96, 0xb4, 0x9b, 0x42, 0xe2, 0x36, 0x65, 0xee, 0x5d, 0xf3, 0x70, 0x64, 0x46, 0x96, 0xb4, - 0x77, 0x63, 0xe4, 0x96, 0xff, 0x25, 0x98, 0x0b, 0xfd, 0x07, 0x94, 0xe1, 0x43, 0x2a, 0xbb, 0x77, - 0x03, 0x8c, 0x44, 0x01, 0x66, 0x2c, 0x69, 0x6f, 0x29, 0xe6, 0x56, 0x04, 0x04, 0x46, 0x19, 0x91, - 0x6f, 0x79, 0xd0, 0x46, 0xe9, 0xb0, 0x5b, 0x33, 0xb9, 0xc2, 0x79, 0x90, 0x4d, 0x9a, 0x92, 0xd8, - 0x45, 0x99, 0x48, 0x05, 0xea, 0xd1, 0x1e, 0x76, 0xe1, 0x1a, 0xf8, 0x2f, 0x4c, 0x6e, 0x73, 0x76, - 0x40, 0x03, 0x0f, 0x4b, 0xca, 0x59, 0xd3, 0x21, 0xbe, 0x6c, 0xa1, 0xd1, 0x92, 0x56, 0xc9, 0x9b, - 0x05, 0x4b, 0xda, 0x8d, 0x3e, 0x71, 0x33, 0xd4, 0xe0, 0x16, 0x98, 0xb7, 0x5b, 0xc4, 0x6e, 0xfb, - 0x9c, 0x32, 0xa9, 0x2a, 0x3f, 0x89, 0xcd, 0x92, 0x7a, 0x84, 0x77, 0x24, 0x1a, 0x8b, 0xec, 0x73, - 0x3d, 0x6c, 0xab, 0x8f, 0xda, 0x8b, 0x21, 0xb8, 0x0c, 0x20, 0xe3, 0x92, 0x1e, 0x84, 0x4d, 0x47, - 0x7b, 0x71, 0xc2, 0x19, 0x41, 0xe3, 0x25, 0xad, 0x32, 0x66, 0x4e, 0xc5, 0x4a, 0x23, 0x12, 0xf6, - 0x39, 0x23, 0x70, 0x11, 0x4c, 0xf6, 0x0f, 0xda, 0x13, 0x2e, 0x02, 0x25, 0xad, 0x92, 0x33, 0xf3, - 0xbd, 0xd9, 0xee, 0x08, 0x17, 0x56, 0xc0, 0xd4, 0x8d, 0x81, 0x86, 0x60, 0x36, 0x02, 0x27, 0xfa, - 0x66, 0x18, 0x92, 0x0b, 0x20, 0x6f, 0x73, 0x26, 0x3a, 0x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- 0x2e, 0x69, 0xf5, 0xdd, 0xb3, 0x5f, 0x7a, 0xea, 0xec, 0x42, 0xd7, 0xce, 0x2f, 0x74, 0xed, 0xe7, - 0x85, 0xae, 0x7d, 0xb8, 0xd4, 0x53, 0xe7, 0x97, 0x7a, 0xea, 0xdb, 0xa5, 0x9e, 0xda, 0x7f, 0xe2, - 0x52, 0xd9, 0xea, 0x58, 0x55, 0x9b, 0x7b, 0x46, 0x5f, 0x92, 0x15, 0xca, 0x93, 0xeb, 0x8a, 0x70, - 0xda, 0xc6, 0xf1, 0xf5, 0xb7, 0x54, 0x76, 0x7d, 0x22, 0xac, 0x4c, 0xf4, 0x09, 0x7d, 0xfc, 0x3b, - 0x00, 0x00, 0xff, 0xff, 0x2b, 0x2a, 0x0c, 0x4d, 0xfc, 0x05, 0x00, 0x00, + // 684 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0xc1, 0x4e, 0xdb, 0x4a, + 0x14, 0x86, 0x63, 0x20, 0x01, 0x26, 0x70, 0xef, 0xd5, 0xdc, 0xb4, 0x98, 0x50, 0x4c, 0x14, 0xaa, + 0x2a, 0x45, 0x10, 0x37, 0x94, 0xb6, 0x12, 0x95, 0xaa, 0x92, 0x20, 0x24, 0x16, 0x54, 0x55, 0xa0, + 0x1b, 0x36, 0xd6, 0xd8, 0x1e, 0x9c, 0x51, 0xf0, 0x8c, 0xe5, 0x39, 0xa1, 0x84, 0x55, 0xd5, 0x5d, + 0x77, 0x7d, 0x80, 0x4a, 0x95, 0xfa, 0x04, 0x2c, 0xfa, 0x10, 0x2c, 0x51, 0x57, 0x5d, 0x55, 0x2d, + 0x2c, 0x78, 0x8d, 0xca, 0xf6, 0x98, 0x04, 0x90, 0x82, 0xaa, 0xae, 0x32, 0x93, 0xff, 0xfb, 0xcf, + 0x7f, 0x8e, 0x75, 0x6c, 0x74, 0xdf, 0x26, 0x76, 0x77, 0x5f, 0xf0, 0x7d, 0x62, 0x4b, 0x53, 0x9d, + 0xcd, 0x83, 0x9a, 0x4d, 0x81, 0xd4, 0x4c, 0x38, 0xac, 0x06, 0xa1, 0x00, 0x81, 0x67, 0xfa, 0xa8, + 0xaa, 0x3a, 0x57, 0x15, 0x55, 0x2c, 0x78, 0xc2, 0x13, 0x31, 0x67, 0x46, 0xa7, 0xc4, 0x52, 0x9c, + 0x72, 0x84, 0xf4, 0x85, 0x34, 0x7d, 0xe9, 0x99, 0x07, 0xb5, 0xe8, 0x47, 0x09, 0xd3, 0x89, 0x60, + 0x25, 0x8e, 0xe4, 0xa2, 0xa4, 0x87, 0x83, 0x9a, 0x49, 0x63, 0x63, 0xb4, 0xfc, 0x21, 0x8b, 0x8c, + 0x2d, 0xe9, 0x6d, 0x72, 0x09, 0x84, 0x03, 0x23, 0x40, 0xeb, 0x89, 0xde, 0x10, 0x1c, 0x42, 0xe2, + 0x80, 0xc4, 0x8f, 0x50, 0x4e, 0x32, 0x8f, 0xd3, 0x50, 0xd7, 0x4a, 0x5a, 0x65, 0xbc, 0xae, 0x7f, + 0xfb, 0xba, 0x54, 0x50, 0x79, 0x6b, 0xae, 0x1b, 0x52, 0x29, 0xb7, 0x21, 0x64, 0xdc, 0x6b, 0x2a, + 0x0e, 0x3f, 0x43, 0xba, 0x4a, 0xb1, 0x1c, 0x55, 0xc6, 0x72, 0x84, 0x4b, 0x2d, 0xe6, 0xea, 0x43, + 0x25, 0xad, 0x32, 0xd2, 0xbc, 0x63, 0x5f, 0x4d, 0x69, 0x08, 0x97, 0x6e, 0xba, 0xf8, 0x05, 0xba, + 0x67, 0x83, 0x63, 0x49, 0x20, 0x6d, 0xc6, 0xbd, 0x9b, 0xe6, 0xe1, 0xd8, 0xac, 0xdb, 0xe0, 0x6c, + 0x27, 0xc8, 0x35, 0xff, 0x4b, 0x34, 0x1b, 0xf9, 0xf7, 0x18, 0x27, 0xfb, 0x0c, 0xba, 0x37, 0x0b, + 0x8c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4, 0xba, 0x24, 0xdd, + 0xb6, 0x79, 0x78, 0xf9, 0xe5, 0x83, 0x6e, 0x40, 0xa5, 0x9d, 0x8b, 0x3f, 0x78, 0x8f, 0x7f, 0x07, + 0x00, 0x00, 0xff, 0xff, 0xf3, 0x9e, 0x2b, 0xd6, 0xaa, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -431,34 +424,20 @@ func (m *MsgInstantiateBabylonContracts) MarshalToSizedBuffer(dAtA []byte) (int, copy(dAtA[i:], m.Admin) i = encodeVarintTx(dAtA, i, uint64(len(m.Admin))) i-- - dAtA[i] = 0x72 + dAtA[i] = 0x62 } if len(m.ConsumerDescription) > 0 { i -= len(m.ConsumerDescription) copy(dAtA[i:], m.ConsumerDescription) i = encodeVarintTx(dAtA, i, uint64(len(m.ConsumerDescription))) i-- - dAtA[i] = 0x6a + dAtA[i] = 0x5a } if len(m.ConsumerName) > 0 { i -= len(m.ConsumerName) copy(dAtA[i:], m.ConsumerName) i = encodeVarintTx(dAtA, i, uint64(len(m.ConsumerName))) i-- - dAtA[i] = 0x62 - } - if len(m.BtcFinalityMsg) > 0 { - i -= len(m.BtcFinalityMsg) - copy(dAtA[i:], m.BtcFinalityMsg) - i = encodeVarintTx(dAtA, i, uint64(len(m.BtcFinalityMsg))) - i-- - dAtA[i] = 0x5a - } - if len(m.BtcStakingMsg) > 0 { - i -= len(m.BtcStakingMsg) - copy(dAtA[i:], m.BtcStakingMsg) - i = encodeVarintTx(dAtA, i, uint64(len(m.BtcStakingMsg))) - i-- dAtA[i] = 0x52 } if m.NotifyCosmosZone { @@ -653,14 +632,6 @@ func (m *MsgInstantiateBabylonContracts) Size() (n int) { if m.NotifyCosmosZone { n += 2 } - l = len(m.BtcStakingMsg) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.BtcFinalityMsg) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = len(m.ConsumerName) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -956,74 +927,6 @@ func (m *MsgInstantiateBabylonContracts) Unmarshal(dAtA []byte) error { } m.NotifyCosmosZone = bool(v != 0) case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BtcStakingMsg", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BtcStakingMsg = append(m.BtcStakingMsg[:0], dAtA[iNdEx:postIndex]...) - if m.BtcStakingMsg == nil { - m.BtcStakingMsg = []byte{} - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BtcFinalityMsg", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BtcFinalityMsg = append(m.BtcFinalityMsg[:0], dAtA[iNdEx:postIndex]...) - if m.BtcFinalityMsg == nil { - m.BtcFinalityMsg = []byte{} - } - iNdEx = postIndex - case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerName", wireType) } @@ -1055,7 +958,7 @@ func (m *MsgInstantiateBabylonContracts) Unmarshal(dAtA []byte) error { } m.ConsumerName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 13: + case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerDescription", wireType) } @@ -1087,7 +990,7 @@ func (m *MsgInstantiateBabylonContracts) Unmarshal(dAtA []byte) error { } m.ConsumerDescription = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 14: + case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) }