Skip to content

Commit

Permalink
Merge branch 'main' into manav/support_out_of_context_shares
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-forbes committed May 18, 2023
2 parents c02815d + 5615205 commit 8d6e812
Show file tree
Hide file tree
Showing 82 changed files with 4,899 additions and 357 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ coverage.txt
tools-stamp
__debug_bin
profile.out
tmp/
run.sh
testing/e2e/networks/*/
square/testdata
16 changes: 10 additions & 6 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import (
"os"
"path/filepath"

"github.com/celestiaorg/celestia-app/x/mint"
mintkeeper "github.com/celestiaorg/celestia-app/x/mint/keeper"
minttypes "github.com/celestiaorg/celestia-app/x/mint/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
Expand Down Expand Up @@ -53,9 +56,6 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1beta2 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
oldgovtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/cosmos/cosmos-sdk/x/mint"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/params"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
Expand Down Expand Up @@ -308,8 +308,12 @@ func New(
appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName),
)
app.MintKeeper = mintkeeper.NewKeeper(
appCodec, keys[minttypes.StoreKey], app.GetSubspace(minttypes.ModuleName), &stakingKeeper,
app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName,
appCodec,
keys[minttypes.StoreKey],
&stakingKeeper,
app.AccountKeeper,
app.BankKeeper,
authtypes.FeeCollectorName,
)
app.DistrKeeper = distrkeeper.NewKeeper(
appCodec, keys[distrtypes.StoreKey], app.GetSubspace(distrtypes.ModuleName), app.AccountKeeper, app.BankKeeper,
Expand Down Expand Up @@ -421,7 +425,7 @@ func New(
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants),
gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
Expand Down
30 changes: 27 additions & 3 deletions app/module.go → app/default_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package app
import (
"encoding/json"

"github.com/celestiaorg/celestia-app/pkg/appconsts"
"github.com/celestiaorg/celestia-app/x/mint"
minttypes "github.com/celestiaorg/celestia-app/x/mint/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank"
Expand All @@ -13,13 +16,13 @@ import (
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/cosmos/cosmos-sdk/x/mint"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
ibcclientclient "github.com/cosmos/ibc-go/v6/modules/core/02-client/client"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
coretypes "github.com/tendermint/tendermint/types"
)

// bankModule defines a custom wrapper around the x/bank module's AppModuleBasic
Expand Down Expand Up @@ -92,7 +95,7 @@ type mintModule struct {
// DefaultGenesis returns custom x/mint module genesis state.
func (mintModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
genState := minttypes.DefaultGenesisState()
genState.Params.MintDenom = BondDenom
genState.Minter.BondDenom = BondDenom

return cdc.MustMarshalJSON(genState)
}
Expand Down Expand Up @@ -127,3 +130,24 @@ func getLegacyProposalHandlers() (result []govclient.ProposalHandler) {

return result
}

// DefaultConsensusParams returns a ConsensusParams with a MaxBytes
// determined using a goal square size.
func DefaultConsensusParams() *tmproto.ConsensusParams {
return &tmproto.ConsensusParams{
Block: DefaultBlockParams(),
Evidence: coretypes.DefaultEvidenceParams(),
Validator: coretypes.DefaultValidatorParams(),
Version: coretypes.DefaultVersionParams(), // TODO: set the default version to 1
}
}

// DefaultBlockParams returns a default BlockParams with a MaxBytes determined
// using a goal square size.
func DefaultBlockParams() tmproto.BlockParams {
return tmproto.BlockParams{
MaxBytes: appconsts.DefaultMaxBytes,
MaxGas: -1,
TimeIotaMs: 1, // 1ms
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion app/prepare_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (app *App) PrepareProposal(req abci.RequestPrepareProposal) abci.ResponsePr

// build the square from the set of valid and prioritised transactions.
// The txs returned are the ones used in the square and block
dataSquare, txs, err := square.Build(txs, appconsts.DefaultMaxSquareSize)
dataSquare, txs, err := square.Build(txs, appconsts.MaxSquareSize)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion app/process_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) abci.ResponsePr
}

// Construct the data square from the block's transactions
dataSquare, err := square.Construct(req.BlockData.Txs, appconsts.DefaultMaxSquareSize)
dataSquare, err := square.Construct(req.BlockData.Txs, appconsts.MaxSquareSize)
if err != nil {
logInvalidPropBlockError(app.Logger(), req.Header, "failure to compute data square from transactions:", err)
return reject()
Expand Down
8 changes: 4 additions & 4 deletions app/test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestIntegrationTestSuite(t *testing.T) {
cfg.EnableTMLogging = false
cfg.MinGasPrices = "0utia"
cfg.NumValidators = 1
cfg.TimeoutCommit = time.Millisecond * 400
cfg.TargetHeightDuration = time.Millisecond * 400
suite.Run(t, NewIntegrationTestSuite(cfg))
}

Expand Down Expand Up @@ -208,12 +208,12 @@ func (s *IntegrationTestSuite) TestMaxBlockSize() {
size := blockRes.Block.Data.SquareSize

// perform basic checks on the size of the square
require.LessOrEqual(size, uint64(appconsts.DefaultMaxSquareSize))
require.GreaterOrEqual(size, uint64(appconsts.DefaultMinSquareSize))
require.LessOrEqual(size, uint64(appconsts.MaxSquareSize))
require.GreaterOrEqual(size, uint64(appconsts.MinSquareSize))
sizes = append(sizes, size)
}
// ensure that at least one of the blocks used the max square size
assert.Contains(sizes, uint64(appconsts.DefaultMaxSquareSize))
assert.Contains(sizes, uint64(appconsts.MaxSquareSize))
})
require.NoError(s.network.WaitForNextBlock())
}
Expand Down
4 changes: 2 additions & 2 deletions app/test/process_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func TestProcessProposal(t *testing.T) {
d.Txs = [][]byte{blobTx}

// Erasure code the data to update the data root so this doesn't doesn't fail on an incorrect data root.
dataSquare, err := square.Construct(d.Txs, appconsts.DefaultMaxSquareSize)
dataSquare, err := square.Construct(d.Txs, appconsts.MaxSquareSize)
require.NoError(t, err)
eds, err := da.ExtendShares(shares.ToBytes(dataSquare))
require.NoError(t, err)
Expand Down Expand Up @@ -280,7 +280,7 @@ func TestProcessProposal(t *testing.T) {
Txs: coretypes.Txs(sendTxs).ToSliceOfBytes(),
},
mutator: func(d *core.Data) {
dataSquare, err := square.Construct(d.Txs, appconsts.DefaultMaxSquareSize)
dataSquare, err := square.Construct(d.Txs, appconsts.MaxSquareSize)
require.NoError(t, err)

b := shares.NewEmptyBuilder().ImportRawShare(dataSquare[1].ToBytes())
Expand Down
5 changes: 4 additions & 1 deletion app/test/qgb_rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ func TestQGBRPCQueries(t *testing.T) {
if testing.Short() {
t.Skip("skipping QGB integration test in short mode.")
}
_, cctx := testnode.DefaultNetwork(t, time.Millisecond)
tmCfg := testnode.DefaultTendermintConfig()
tmCfg.Consensus.TargetHeightDuration = time.Millisecond

cctx, _, _ := testnode.NewNetwork(t, testnode.DefaultParams(), tmCfg, testnode.DefaultAppConfig())
h, err := cctx.WaitForHeightWithTimeout(105, 2*time.Minute)
require.NoError(t, err, h)
require.Greater(t, h, int64(101))
Expand Down
10 changes: 7 additions & 3 deletions app/test/std_sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"math/big"
"sync"
"testing"
"time"

"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/encoding"
Expand Down Expand Up @@ -48,7 +47,7 @@ type StandardSDKIntegrationTestSuite struct {
func (s *StandardSDKIntegrationTestSuite) SetupSuite() {
t := s.T()
t.Log("setting up integration test suite")
accounts, cctx := testnode.DefaultNetwork(t, time.Millisecond*400)
accounts, cctx := testnode.DefaultNetwork(t)
s.accounts = accounts
s.ecfg = encoding.MakeConfig(app.ModuleEncodingRegisters...)
s.cctx = cctx
Expand Down Expand Up @@ -163,7 +162,12 @@ func (s *StandardSDKIntegrationTestSuite) TestStandardSDK() {
name: "create legacy community spend governance proposal",
msgFunc: func() (msgs []sdk.Msg, signer string) {
account := s.unusedAccount()
coins := sdk.NewCoins(sdk.NewCoin(app.BondDenom, sdk.NewInt(1000000)))
// Note: this test depends on at least one coin being present
// in the community pool. Funds land in the community pool due
// to inflation so if 1 coin is not present in the community
// pool, consider expanding the block interval or waiting for
// more blocks to be produced prior to executing this test case.
coins := sdk.NewCoins(sdk.NewCoin(app.BondDenom, sdk.NewInt(1)))
content := disttypes.NewCommunityPoolSpendProposal(
"title",
"description",
Expand Down
9 changes: 9 additions & 0 deletions cmd/celestia-appd/cmd/overrides.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/pkg/appconsts"
"github.com/cosmos/cosmos-sdk/server"
"github.com/spf13/cobra"
Expand All @@ -15,3 +16,11 @@ func overrideServerConfig(command *cobra.Command) error {
ctx.Config.Consensus.SkipTimeoutCommit = false
return server.SetCmdServerContext(command, ctx)
}

// setDefaultConsensusParams sets the default consensus parameters for the
// embedded server context.
func setDefaultConsensusParams(command *cobra.Command) error {
ctx := server.GetServerContextFromCmd(command)
ctx.DefaultConsensusParams = app.DefaultConsensusParams()
return server.SetCmdServerContext(command, ctx)
}
5 changes: 5 additions & 0 deletions cmd/celestia-appd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ func NewRootCmd() *cobra.Command {
return err
}

err = setDefaultConsensusParams(cmd)
if err != nil {
return err
}

return overrideServerConfig(cmd)
},
SilenceUsage: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ If the calculated commitment doesn't equal the commitment in the PFB transaction

We are comparing the size of a PFB inclusion proof to a worst-case blob inclusion proof.

The size of a normal PFB transaction is about 330 bytes. This PFB transaction can span over 2 shares because the start of a transaction can happen in the middle of a share. The worst case is if the transaction starts in the middle of the share of the last block in a row and continues to the first share of the row after. The picture below shows this scenario and what you need to prove the inclusion of those shares. It is a Merkle Proof of the shares to ROW1 and ROW2 and then a Merkle proof of ROW1 and ROW2 to the DataRoot. The blue nodes are additional nodes that are needed for the Merkle proof.
The size of a normal PFB transaction is about 330 bytes. This PFB transaction can span over 2 shares because the start of a transaction can occur in the middle of a share. In the worst case scenario, a transaction starts in the middle of the last share in a row and continues to the first share of the next row. This worst case scenario is depicted by the pink squares in the diagram below. In order to prove the inclusion of the pink shares, one needs:

1. A NMT proof of the first share to ROW1's `RowRoot`.
1. A NMT proof of the second share to ROW2's `RowRoot`.
1. A Merkle proof of the `RowRoot`s from ROW1 and ROW2 to the `DataRoot`.

Note: the blue nodes are additional nodes that are needed for the Merkle proofs.

![PFB Merkle Proof](./assets/adr011/pfd-merkle-proof.png)

Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/adr-015-namespace-id-size.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Another tradeoff to consider is the size of the namespace in the share. Since a

### Maximum blob size

If the namespace size is increased, the maximum possible blob will decrease. Given the maximum possible blob is bounded by the number of bytes available for blob space in a data square, if a 32 byte namespace size is adopted, the maxmimum blob size will decrease by an upper bound of `appconsts.DefaultMaxSquareSize * appconsts.DefaultMaxSquareSize * (32-8)`. Note this is an upper bound because not all shares in the data square can be used for blob data (i.e. at least one share must contain the associated PayForBlob transaction).
If the namespace size is increased, the maximum possible blob will decrease. Given the maximum possible blob is bounded by the number of bytes available for blob space in a data square, if a 32 byte namespace size is adopted, the maxmimum blob size will decrease by an upper bound of `appconsts.MaxSquareSize * appconsts.MaxSquareSize * (32-8)`. Note this is an upper bound because not all shares in the data square can be used for blob data (i.e. at least one share must contain the associated PayForBlob transaction).

### SHA256 performance

Expand Down
9 changes: 4 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
require (
cosmossdk.io/errors v1.0.0-beta.7
cosmossdk.io/math v1.0.0-beta.3
github.com/celestiaorg/rsmt2d v0.8.0
github.com/celestiaorg/rsmt2d v0.9.0
github.com/cosmos/cosmos-proto v1.0.0-alpha8
github.com/cosmos/cosmos-sdk v0.46.11
github.com/cosmos/gogoproto v1.4.2
Expand Down Expand Up @@ -180,7 +180,6 @@ require (
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/vivint/infectious v0.0.0-20200605153912-25a574ae18a3 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
Expand All @@ -191,7 +190,7 @@ require (
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.102.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 // indirect
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand All @@ -200,7 +199,7 @@ require (
)

replace (
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.12.0-sdk-v0.46.11
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.13.0-sdk-v0.46.11
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.19.0-tm-v0.34.27
github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.20.0-tm-v0.34.27
)
14 changes: 6 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,18 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f
github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/celestiaorg/celestia-core v1.19.0-tm-v0.34.27 h1:GLdDJRu1fRSMft4IqQz4/x/H1U3eN2TFlYbAycbSiN4=
github.com/celestiaorg/celestia-core v1.19.0-tm-v0.34.27/go.mod h1:8PbX2OIPehldawXWAzNWPxBPnfFtcYtjHecE45b2Beg=
github.com/celestiaorg/cosmos-sdk v1.12.0-sdk-v0.46.11 h1:Y+/dAyu7t0F8+EZz+jU3tyZqG10W8LTCQpnHe8Ejuec=
github.com/celestiaorg/cosmos-sdk v1.12.0-sdk-v0.46.11/go.mod h1:uKEyhG8H8hbjebOEEgtyqghJWpuMyF+u61MK5cis+pk=
github.com/celestiaorg/celestia-core v1.20.0-tm-v0.34.27 h1:zyAhkcRNsYvt1FglnzOyw3WV9fOn4aXaXUsz87NAunk=
github.com/celestiaorg/celestia-core v1.20.0-tm-v0.34.27/go.mod h1:8PbX2OIPehldawXWAzNWPxBPnfFtcYtjHecE45b2Beg=
github.com/celestiaorg/cosmos-sdk v1.13.0-sdk-v0.46.11 h1:Rd5EvJx1nG3KurBspVN51RVmvif0Lp2UVURbG2ad3Cs=
github.com/celestiaorg/cosmos-sdk v1.13.0-sdk-v0.46.11/go.mod h1:xCG6OUkJy5KUMEg20Zk010lra9XjkmKS3+bk0wp7bd8=
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc=
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA=
github.com/celestiaorg/nmt v0.15.0 h1:ID9QlMIeP6WK/iiGcfnYLu2qqVIq0UYe/dc3TVPt6EA=
github.com/celestiaorg/nmt v0.15.0/go.mod h1:GfwIvQPhUakn1modWxJ+rv8dUjJzuXg5H+MLFM1o7nY=
github.com/celestiaorg/quantum-gravity-bridge v1.3.0 h1:9zPIp7w1FWfkPnn16y3S4FpFLnQtS7rm81CUVcHEts0=
github.com/celestiaorg/quantum-gravity-bridge v1.3.0/go.mod h1:6WOajINTDEUXpSj5UZzod16UZ96ZVB/rFNKyM+Mt1gI=
github.com/celestiaorg/rsmt2d v0.8.0 h1:ZUxTCELZCM9zMGKNF3cT+rUqMddXMeiuyleSJPZ3Wn4=
github.com/celestiaorg/rsmt2d v0.8.0/go.mod h1:hhlsTi6G3+X5jOP/8Lb/d7i5y2XNFmnyMddYbFSmrgo=
github.com/celestiaorg/rsmt2d v0.9.0 h1:kon78I748ZqjNzI8OAqPN+2EImuZuanj/6gTh8brX3o=
github.com/celestiaorg/rsmt2d v0.9.0/go.mod h1:E06nDxfoeBDltWRvTR9dLviiUZI5/6mLXAuhSJzz3Iw=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
Expand Down Expand Up @@ -1017,8 +1017,6 @@ github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa h1:5SqCsI/2Qya2bC
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/vivint/infectious v0.0.0-20200605153912-25a574ae18a3 h1:zMsHhfK9+Wdl1F7sIKLyx3wrOFofpb3rWFbA4HgcK5k=
github.com/vivint/infectious v0.0.0-20200605153912-25a574ae18a3/go.mod h1:R0Gbuw7ElaGSLOZUSwBm/GgVwMd30jWxBDdAyMOeTuc=
github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
Expand Down
22 changes: 15 additions & 7 deletions pkg/appconsts/appconsts.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const (
NamespaceVersionSize = 1

// NamespaceIDSize is the size of a namespace ID in bytes.
NamespaceIDSize = 32
NamespaceIDSize = 28

// NamespaceSize is the size of a namespace (version + ID) in bytes.
NamespaceSize = NamespaceVersionSize + NamespaceIDSize
Expand Down Expand Up @@ -55,22 +55,30 @@ const (
// in a continuation sparse share of a sequence.
ContinuationSparseShareContentSize = ShareSize - NamespaceSize - ShareInfoBytes

// DefaultMaxSquareSize is the maximum original square width.
// MaxSquareSize is the maximum original square width.
//
// Note: 128 shares in a row * 128 shares in a column * 512 bytes in a share
// = 8 MiB
DefaultMaxSquareSize = 128
MaxSquareSize = 128

// DefaultGovMaxSquareSize is the default value for the governance modifiable
// max square size.
DefaultGovMaxSquareSize = 64

// DefaultMaxBytes is the default value for the maximum number of bytes
// allowed in a valid block.
DefaultMaxBytes = DefaultGovMaxSquareSize * DefaultGovMaxSquareSize * ContinuationSparseShareContentSize

// MaxShareCount is the maximum number of shares allowed in the original
// data square.
MaxShareCount = DefaultMaxSquareSize * DefaultMaxSquareSize
MaxShareCount = MaxSquareSize * MaxSquareSize

// DefaultMinSquareSize is the smallest original square width.
DefaultMinSquareSize = 1
// MinSquareSize is the smallest original square width.
MinSquareSize = 1

// MinshareCount is the minimum number of shares allowed in the original
// data square.
MinShareCount = DefaultMinSquareSize * DefaultMinSquareSize
MinShareCount = MinSquareSize * MinSquareSize

// SubtreeRootThreshold works as a target value for the number of subtree roots in the
// share commitment. If a blob contains more shares than this number, than the height
Expand Down
Loading

0 comments on commit 8d6e812

Please sign in to comment.