Skip to content

Commit

Permalink
remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
NagaTulasi committed Oct 1, 2024
1 parent 2e8d43b commit f5f4559
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
2 changes: 0 additions & 2 deletions chainclient/create_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ const (
defaultGasLimit = 300000
)

// var availdHomePath = xfilepath.JoinFromHome(xfilepath.Path("availsdk"))

func NewClientCtx(kr keyring.Keyring, c *cometrpc.HTTP, chainID string,
cdc codec.BinaryCodec, homepath string, fromAddress sdk.AccAddress,
) client.Context {
Expand Down
39 changes: 22 additions & 17 deletions x/cada/simulation/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/cosmos/cosmos-sdk/x/simulation"
cadakeeper "github.com/vitwit/avail-da-module/x/cada/keeper"
availtypes "github.com/vitwit/avail-da-module/x/cada/types"
cadatypes "github.com/vitwit/avail-da-module/x/cada/types"
)

const (
Expand Down Expand Up @@ -44,45 +44,51 @@ func SimulateMsgUpdateBlobStatus(ak authkeeper.AccountKeeper, bk bankkeeper.Keep
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, _ string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
ctx = ctx.WithBlockHeight(20)
// Randomly select a sender account

sender, _ := simtypes.RandomAcc(r, accs)

// Ensure the sender has sufficient balance
account := ak.GetAccount(ctx, sender.Address)
spendable := bk.SpendableCoins(ctx, account.GetAddress())

// Generate random fees for the transaction
fees, err := simtypes.RandomFees(r, ctx, spendable)
if err != nil {
return simtypes.NoOpMsg(availtypes.ModuleName, availtypes.TypeMsgUpdateBlobStatus, "unable to generate fees"), nil, err
return simtypes.NoOpMsg(cadatypes.ModuleName, cadatypes.TypeMsgUpdateBlobStatus, "unable to generate fees"), nil, err
}

// Prepare a random blob status update
newStatus := true // You can randomize this value as needed
fromBlock := uint64(5) // Example block range start
toBlock := uint64(20) // Example block range end
newStatus := true
fromBlock := uint64(5)
toBlock := uint64(20)
availHeight := uint64(120)

ran := availtypes.Range{
ran := cadatypes.Range{
From: fromBlock,
To: toBlock,
}

msg := availtypes.NewMsgUpdateBlobStatus(
msg := cadatypes.NewMsgUpdateBlobStatus(
sender.Address.String(),
ran,
availHeight,
newStatus,
)

store := ctx.KVStore(k.GetStoreKey())
cadakeeper.UpdateEndHeight(ctx, store, uint64(20))

cadakeeper.UpdateProvenHeight(ctx, store, uint64(4))
err = cadakeeper.UpdateEndHeight(ctx, store, uint64(20))
if err != nil {
return simtypes.NoOpMsg(cadatypes.ModuleName, cadatypes.TypeMsgUpdateBlobStatus, "unable to update end height"), nil, err
}

err = cadakeeper.UpdateProvenHeight(ctx, store, uint64(4))
if err != nil {
return simtypes.NoOpMsg(cadatypes.ModuleName, cadatypes.TypeMsgUpdateBlobStatus, "unable to update proven height"), nil, err
}

cadakeeper.UpdateBlobStatus(ctx, store, uint32(1))
err = cadakeeper.UpdateBlobStatus(ctx, store, uint32(1))
if err != nil {
return simtypes.NoOpMsg(cadatypes.ModuleName, cadatypes.TypeMsgUpdateBlobStatus, "unable to update status to pending state"), nil, err
}

// Set up the transaction context
txCtx := simulation.OperationInput{
R: r,
App: app,
Expand All @@ -92,10 +98,9 @@ func SimulateMsgUpdateBlobStatus(ak authkeeper.AccountKeeper, bk bankkeeper.Keep
Context: ctx,
SimAccount: sender,
AccountKeeper: ak,
ModuleName: availtypes.ModuleName,
ModuleName: cadatypes.ModuleName,
}

// Generate and deliver the transaction
return simulation.GenAndDeliverTx(txCtx, fees)
}
}

0 comments on commit f5f4559

Please sign in to comment.