Skip to content

Commit

Permalink
call using permissionkeeper
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianElvis committed Jan 9, 2025
1 parent 63c3c5c commit 77c82dd
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions tests/e2e/local_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"testing"

"github.com/CosmWasm/wasmd/x/wasm/ibctesting"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"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"
Expand Down Expand Up @@ -110,16 +111,18 @@ func (s *BabylonSDKTestSuite) Test2MockConsumerFpDelegation() {
s.NoError(err)
// send headers to the Babylon contract. This is to ensure that the contract is
// indexing BTC headers correctly.
res, err := s.ConsumerCli.Exec(s.ConsumerContract.Babylon, headersMsgBytes)
contractKeeper := wasmkeeper.NewGovPermissionKeeper(s.ConsumerApp.WasmKeeper)
res, err := contractKeeper.Execute(s.ConsumerChain.GetContext(), s.ConsumerContract.Babylon, s.ConsumerCli.GetSender(), headersMsgBytes, sdk.Coins{})
s.NoError(err, res)

testMsg = types.GenExecMessage()
msgBytes, err := json.Marshal(testMsg)
s.NoError(err)

// send msg to BTC staking contract via admin account
_, err = s.ConsumerCli.Exec(s.ConsumerContract.BTCStaking, msgBytes)
s.NoError(err)
contractKeeper = wasmkeeper.NewGovPermissionKeeper(s.ConsumerApp.WasmKeeper)
res, err = contractKeeper.Execute(s.ConsumerChain.GetContext(), s.ConsumerContract.BTCStaking, s.ConsumerCli.GetSender(), msgBytes, sdk.Coins{})
s.NoError(err, res)

// ensure the finality provider is on consumer chain
consumerFps, err := s.ConsumerCli.Query(s.ConsumerContract.BTCStaking, types.Query{"finality_providers": {}})
Expand All @@ -130,13 +133,6 @@ func (s *BabylonSDKTestSuite) Test2MockConsumerFpDelegation() {
consumerDels, err := s.ConsumerCli.Query(s.ConsumerContract.BTCStaking, types.Query{"delegations": {}})
s.NoError(err)
s.NotEmpty(consumerDels)

// ensure the BTC staking is activated
resp, err := s.ConsumerCli.Query(s.ConsumerContract.BTCStaking, types.Query{"activated_height": {}})
s.NoError(err)
parsedActivatedHeight := resp["height"].(float64)
currentHeight := s.ConsumerChain.GetContext().BlockHeight()
s.Equal(uint64(parsedActivatedHeight), uint64(currentHeight))
}

func (s *BabylonSDKTestSuite) Test3BeginBlock() {
Expand Down

0 comments on commit 77c82dd

Please sign in to comment.