mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 00:05:18 +00:00
remove unecessary code
This commit is contained in:
parent
5645f5a766
commit
0b905b3d75
@ -1,41 +0,0 @@
|
|||||||
package app
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
|
||||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
|
||||||
|
|
||||||
"github.com/kava-labs/kava/app"
|
|
||||||
)
|
|
||||||
|
|
||||||
// This will fail half the time with the second output being 173
|
|
||||||
// This is due to secp256k1 signatures not being constant size.
|
|
||||||
// nolint: vet
|
|
||||||
func ExampleTxSendSize() {
|
|
||||||
cdc := app.MakeCodec()
|
|
||||||
var gas uint64 = 1
|
|
||||||
|
|
||||||
priv1 := secp256k1.GenPrivKeySecp256k1([]byte{0})
|
|
||||||
addr1 := sdk.AccAddress(priv1.PubKey().Address())
|
|
||||||
priv2 := secp256k1.GenPrivKeySecp256k1([]byte{1})
|
|
||||||
addr2 := sdk.AccAddress(priv2.PubKey().Address())
|
|
||||||
coins := sdk.Coins{sdk.NewCoin("denom", sdk.NewInt(10))}
|
|
||||||
msg1 := bank.MsgMultiSend{
|
|
||||||
Inputs: []bank.Input{bank.NewInput(addr1, coins)},
|
|
||||||
Outputs: []bank.Output{bank.NewOutput(addr2, coins)},
|
|
||||||
}
|
|
||||||
fee := auth.NewStdFee(gas, coins)
|
|
||||||
signBytes := auth.StdSignBytes("example-chain-ID",
|
|
||||||
1, 1, fee, []sdk.Msg{msg1}, "")
|
|
||||||
sig, _ := priv1.Sign(signBytes)
|
|
||||||
sigs := []auth.StdSignature{{nil, sig}}
|
|
||||||
tx := auth.NewStdTx([]sdk.Msg{msg1}, fee, sigs, "")
|
|
||||||
fmt.Println(len(cdc.MustMarshalBinaryBare([]sdk.Msg{msg1})))
|
|
||||||
fmt.Println(len(cdc.MustMarshalBinaryBare(tx)))
|
|
||||||
// output: 80
|
|
||||||
// 169
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package app
|
|
||||||
|
|
||||||
// import (
|
|
||||||
// "fmt"
|
|
||||||
// "time"
|
|
||||||
|
|
||||||
// abci "github.com/tendermint/tendermint/abci/types"
|
|
||||||
|
|
||||||
// sdk "github.com/cosmos/cosmos-sdk/types"
|
|
||||||
// )
|
|
||||||
|
|
||||||
// func (app *App) assertRuntimeInvariants() {
|
|
||||||
// ctx := app.NewContext(false, abci.Header{Height: app.LastBlockHeight() + 1})
|
|
||||||
// app.assertRuntimeInvariantsOnContext(ctx)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func (app *App) assertRuntimeInvariantsOnContext(ctx sdk.Context) {
|
|
||||||
// start := time.Now()
|
|
||||||
// invarRoutes := app.crisisKeeper.Routes()
|
|
||||||
// for _, ir := range invarRoutes {
|
|
||||||
// if err := ir.Invar(ctx); err != nil {
|
|
||||||
// panic(fmt.Errorf("invariant broken: %s\n"+
|
|
||||||
// "\tCRITICAL please submit the following transaction:\n"+
|
|
||||||
// "\t\t kvcli tx crisis invariant-broken %v %v", err, ir.ModuleName, ir.Route))
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// end := time.Now()
|
|
||||||
// diff := end.Sub(start)
|
|
||||||
// app.BaseApp.Logger().With("module", "invariants").Info(
|
|
||||||
// "Asserted all invariants", "duration", diff, "height", app.LastBlockHeight())
|
|
||||||
// }
|
|
Loading…
Reference in New Issue
Block a user