diff --git a/app/config.go b/app/config.go new file mode 100644 index 00000000..c6cd322e --- /dev/null +++ b/app/config.go @@ -0,0 +1,13 @@ +package app + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func init() { + cfg := sdk.GetConfig() + cfg.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub) + cfg.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub) + cfg.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub) + cfg.Seal() +} diff --git a/app/estimate_square_size_test.go b/app/estimate_square_size_test.go index c86467c8..ca845bff 100644 --- a/app/estimate_square_size_test.go +++ b/app/estimate_square_size_test.go @@ -3,6 +3,10 @@ package app import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + coretypes "github.com/tendermint/tendermint/types" + "github.com/celestiaorg/celestia-app/app/encoding" "github.com/celestiaorg/celestia-app/pkg/appconsts" "github.com/celestiaorg/celestia-app/pkg/shares" @@ -10,9 +14,6 @@ import ( "github.com/celestiaorg/celestia-app/testutil/namespace" "github.com/celestiaorg/celestia-app/testutil/testfactory" blobtypes "github.com/celestiaorg/celestia-app/x/blob/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - coretypes "github.com/tendermint/tendermint/types" ) func Test_estimateSquareSize(t *testing.T) { @@ -146,7 +147,7 @@ func Test_estimatePFBTxSharesUsed(t *testing.T) { } func Test_estimateTxSharesUsed(t *testing.T) { - require.Equal(t, 312, len(generateNormalTxs(3)[2])) + require.Equal(t, 316, len(generateNormalTxs(3)[2])) type testCase struct { name string txs [][]byte @@ -154,10 +155,10 @@ func Test_estimateTxSharesUsed(t *testing.T) { } testCases := []testCase{ {"empty", [][]byte{}, 0}, - {"one tx", generateNormalTxs(1), 1}, // 1 tx is approximately 312 bytes which fits in 1 share - {"two txs", generateNormalTxs(2), 2}, // 2 txs is approximately 624 bytes which fits in 2 shares - {"ten txs", generateNormalTxs(10), 7}, // 10 txs is approximately 3120 bytes which fits in 7 shares - {"one hundred txs", generateNormalTxs(100), 63}, // 100 txs is approximately 31200 bytes which fits in 63 share + {"one tx", generateNormalTxs(1), 1}, // 1 tx is approximately 316 bytes which fits in 1 share + {"two txs", generateNormalTxs(2), 2}, // 2 txs is approximately 632 bytes which fits in 2 shares + {"ten txs", generateNormalTxs(10), 7}, // 10 txs is approximately 3160 bytes which fits in 7 shares + {"one hundred txs", generateNormalTxs(100), 64}, // 100 txs is approximately 31600 bytes which fits in 64 share } for _, tc := range testCases { got := estimateTxSharesUsed(tc.txs) diff --git a/cmd/celestia-appd/cmd/root.go b/cmd/celestia-appd/cmd/root.go index 178c8a3b..3096153d 100644 --- a/cmd/celestia-appd/cmd/root.go +++ b/cmd/celestia-appd/cmd/root.go @@ -49,12 +49,6 @@ const EnvPrefix = "CELESTIA" func NewRootCmd() *cobra.Command { encodingConfig := encoding.MakeConfig(app.ModuleEncodingRegisters...) - cfg := sdk.GetConfig() - cfg.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub) - cfg.SetBech32PrefixForValidator(app.Bech32PrefixValAddr, app.Bech32PrefixValPub) - cfg.SetBech32PrefixForConsensusNode(app.Bech32PrefixConsAddr, app.Bech32PrefixConsPub) - cfg.Seal() - initClientCtx := client.Context{}. WithCodec(encodingConfig.Codec). WithInterfaceRegistry(encodingConfig.InterfaceRegistry).