Skip to content

Commit

Permalink
dev: bump export custom
Browse files Browse the repository at this point in the history
  • Loading branch information
hard-nett committed Mar 11, 2025
1 parent bbd8a08 commit dc38640
Showing 1 changed file with 6 additions and 42 deletions.
48 changes: 6 additions & 42 deletions app/export_custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ func (app *BitsongApp) customTestUpgradeHandlerLogicViaExport(ctx sdk.Context, j
})
condJSON.DistSlashStore.SlashEventCount = slashCount

// Marshal the ConditionalJSON object to JSON
v022.PrintConditionalJsonLogs(condJSON, "conditional.json")
// /* Just to be safe, assert the invariants on current state. */
app.AppKeepers.CrisisKeeper.AssertInvariants(ctx)

Expand All @@ -159,45 +157,11 @@ func (app *BitsongApp) customTestUpgradeHandlerLogicViaExport(ctx sdk.Context, j
if err != nil {
panic(err)
}
rewardsRaw, patched := v022.CustomCalculateDelegationRewards(ctx, &app.AppKeepers, val, del, endingPeriod)

if patched {
condJSON.PatchedDelegation = append(condJSON.PatchedDelegation, v022.PatchedDelegation{
OperatorAddress: val.OperatorAddress,
DelegatorAddress: del.DelegatorAddress,
PatchedDelegation: rewardsRaw.AmountOf("ubtsg").String(),
})

//export logic omits assertion of error, as shown here: https://github.com/permissionlessweb/bitsong-cosmos-sdk/blob/92e7f67f9601e5f2dc7b1daebd24e8a37efbcc72/simapp/export.go#L106
_, err := v022.CustomWithdrawDelegationRewards(ctx, &app.AppKeepers, val, del, endingPeriod)

if err != nil {
fmt.Printf("err: %v\n", err)
return false
}

} else {
fmt.Printf("val.OperatorAddress: %v\n", val.OperatorAddress)
fmt.Printf("del.DelegatorAddress: %v\n", del.DelegatorAddress)
return false

_, err = app.AppKeepers.DistrKeeper.CalculateDelegationRewards(ctx, val, del, endingPeriod)
if err != nil {
panic(err)
}
if val.OperatorAddress == "bitsongvaloper1qxw4fjged2xve8ez7nu779tm8ejw92rv0vcuqr" ||
val.OperatorAddress == "bitsongvaloper1xnc32z84cc9vwftvv4w0v02a2slug3tjt6qyct" {

// // end current period and calculate rewards
// endingPeriod, err := app.AppKeepers.DistrKeeper.IncrementValidatorPeriod(ctx, val)
// if err != nil {
// panic(err)
// }

// panic if we cannot calculate rewards for impacted validators
_, err = app.AppKeepers.DistrKeeper.CalculateDelegationRewards(ctx, val, del, endingPeriod)
if err != nil {
panic(err)
}

}
return false

})
Expand All @@ -208,9 +172,6 @@ func (app *BitsongApp) customTestUpgradeHandlerLogicViaExport(ctx sdk.Context, j
panic(err)
}

// Marshal the ConditionalJSON object to JSON
v022.PrintConditionalJsonLogs(condJSON, "conditional.json")

// clear validator slash events
app.AppKeepers.DistrKeeper.DeleteAllValidatorSlashEvents(ctx)

Expand Down Expand Up @@ -331,4 +292,7 @@ func (app *BitsongApp) customTestUpgradeHandlerLogicViaExport(ctx sdk.Context, j
},
)

// Marshal the ConditionalJSON object to JSON
v022.PrintConditionalJsonLogs(condJSON, "conditional.json")

}

0 comments on commit dc38640

Please sign in to comment.