Skip to content

Commit

Permalink
Merge branch 'main' into cal/e2e-test
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters committed Jul 17, 2023
2 parents 4f53156 + 83aff91 commit ce43a20
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ require (
)

replace (
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.16.0-sdk-v0.46.13
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.16.1-sdk-v0.46.13
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.24.0-tm-v0.34.28
github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.25.0-tm-v0.34.28
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ github.com/bufbuild/protocompile v0.1.0 h1:HjgJBI85hY/qmW5tw/66sNDZ7z0UDdVSi/5r4
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.24.0-tm-v0.34.28 h1:eXS3v26nob8Xs2+flKHVxcTzhzQW44KgTcooR3OxnK4=
github.com/celestiaorg/celestia-core v1.24.0-tm-v0.34.28/go.mod h1:J/GsBjoTZaFz71VeyrLZbG8rV+Rzi6oFEUZUipQ97hQ=
github.com/celestiaorg/cosmos-sdk v1.16.0-sdk-v0.46.13 h1:N1PrCWcYkaODeIQyyVBmDKDTwiQWZ31bgtTEYIGeby8=
github.com/celestiaorg/cosmos-sdk v1.16.0-sdk-v0.46.13/go.mod h1:xpBZc/OYZ736hp0IZlBGNUhEgCD9C+bKs8yNLZibyv0=
github.com/celestiaorg/celestia-core v1.25.0-tm-v0.34.28 h1:2/b6288LWPPJqb8vxdiafXvBwy/42Edp5rJIVxbBRvg=
github.com/celestiaorg/celestia-core v1.25.0-tm-v0.34.28/go.mod h1:J/GsBjoTZaFz71VeyrLZbG8rV+Rzi6oFEUZUipQ97hQ=
github.com/celestiaorg/cosmos-sdk v1.16.1-sdk-v0.46.13 h1:CxEQDQEQR1ypB+VUmCISIqFVmHfb+mx8x+zh7rHbyU8=
github.com/celestiaorg/cosmos-sdk v1.16.1-sdk-v0.46.13/go.mod h1:xpBZc/OYZ736hp0IZlBGNUhEgCD9C+bKs8yNLZibyv0=
github.com/celestiaorg/knuu v0.8.2 h1:x63nYTO46j293VkNP7VcRHtYHSize6dM/h7xME2Vgi0=
github.com/celestiaorg/knuu v0.8.2/go.mod h1:zBrMXhFl7irCPOVJyHS8sBg7K9Hux5dLy9VChA40LTo=
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc=
Expand Down
7 changes: 1 addition & 6 deletions pkg/square/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (b *Builder) Export() (Square, error) {
// sort the blobs in order of namespace. We use slice stable here to respect the
// order of multiple blobs within a namespace as per the priority of the PFB
sort.SliceStable(b.Blobs, func(i, j int) bool {
return bytes.Compare(FullNamespace(b.Blobs[i].Blob), FullNamespace(b.Blobs[j].Blob)) < 0
return bytes.Compare(b.Blobs[i].Blob.Namespace(), b.Blobs[j].Blob.Namespace()) < 0
})

// write all the regular transactions into compact shares
Expand Down Expand Up @@ -366,11 +366,6 @@ func (b *Builder) IsEmpty() bool {
return b.TxCounter.Size() == 0 && b.PfbCounter.Size() == 0
}

// TODO: celestia-core should provide this method for `Blob`s
func FullNamespace(blob core.Blob) []byte {
return append([]byte{byte(blob.NamespaceVersion)}, blob.NamespaceID...)
}

type Element struct {
Blob core.Blob
PfbIndex int
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-run-single-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ sed -i'.bak' 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' ${HOME_DIR}/con
sed -i'.bak' 's#"null"#"kv"#g' ${HOME_DIR}/config/config.toml

# Start the celestia-app
${BIN_PATH} start --home ${HOME_DIR}
${BIN_PATH} start --home ${HOME_DIR} --api.enable
2 changes: 1 addition & 1 deletion scripts/single-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ sed -i'.bak' 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' ${HOME_DIR}/con
sed -i'.bak' 's#"null"#"kv"#g' ${HOME_DIR}/config/config.toml

# Start the celestia-app
celestia-appd start --home ${HOME_DIR}
celestia-appd start --home ${HOME_DIR} --api.enable
4 changes: 2 additions & 2 deletions test/util/malicious/out_of_order_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ func OutOfOrderExport(b *square.Builder) (square.Square, error) {
// sort the blobs in order of namespace. We use slice stable here to respect the
// order of multiple blobs within a namespace as per the priority of the PFB
sort.SliceStable(b.Blobs, func(i, j int) bool {
return bytes.Compare(square.FullNamespace(b.Blobs[i].Blob), square.FullNamespace(b.Blobs[j].Blob)) < 0
return bytes.Compare(b.Blobs[i].Blob.Namespace(), b.Blobs[j].Blob.Namespace()) < 0
})

if len(b.Blobs) > 1 {
// iterate through each blob and find the first two that have different
// namespaces and swap them.
for i := 0; i < len(b.Blobs)-1; i++ {
if !bytes.Equal(square.FullNamespace(b.Blobs[i].Blob), square.FullNamespace(b.Blobs[i+1].Blob)) {
if !bytes.Equal(b.Blobs[i].Blob.Namespace(), b.Blobs[i+1].Blob.Namespace()) {
b.Blobs[i], b.Blobs[i+1] = b.Blobs[i+1], b.Blobs[i]
break
}
Expand Down

0 comments on commit ce43a20

Please sign in to comment.