-
Notifications
You must be signed in to change notification settings - Fork 924
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): upgrade to celestia-app v2.0.0 (#3453)
Update celestia-node to use celestia-app v2.0.0. A few changes that were needed: - celestia-app v1.x had a shares package. celestia-app v2.x uses the shares package from go-square. - celestia-app v1.x had a blob.types package with `CreateCommitment`. celestia-app v2.x uses `CreateCommitment` from the go-square inclusion package. - I had to update extended header verification to allow `header.Version.App = 2`. Added unit tests. - celestia-app v1.x had a lot of functionality included in the `signer`. celestia-app v2.x split a `txClient` from the `signer`. See: celestiaorg/celestia-app#3433 - ~~I had to update `core_access.go` a lot. Mostly inspired by #3451 ## Testing I ran a [script](https://gist.github.com/rootulp/73ee382b4d533cb9da27fc675e9047c0) with: celestia-app v2.0.0-rc2 and configured it to upgrade at block height 3. celestia-node (built from this PR) continued to work: ``` 2024-07-09T18:13:27.040-0400 INFO header/store store/store.go:367 new head {"height": 2, "hash": "8776AEAF4114BD7E88E8DEC38445720D0BD857335BED99649957A43BB845EC87"} 2024-07-09T18:13:38.065-0400 INFO header/store store/store.go:367 new head {"height": 3, "hash": "63D5C64521A964290BD21658314DDF60146AE419FE99026003048F74D2886B35"} 2024-07-09T18:13:49.093-0400 INFO header/store store/store.go:367 new head {"height": 4, "hash": "FC7900918E716697A7CD6D9A4865B261F3E71D181F366E765AA53CF475223F9A"} ```
- Loading branch information
Showing
78 changed files
with
670 additions
and
410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package blob | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"github.com/celestiaorg/celestia-app/v2/pkg/appconsts" | ||
squareblob "github.com/celestiaorg/go-square/blob" | ||
"github.com/celestiaorg/go-square/namespace" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestBlobsToShares(t *testing.T) { | ||
t.Run("should sort blobs by namespace in ascending order", func(t *testing.T) { | ||
namespaceA := namespace.MustNewV0(bytes.Repeat([]byte{0xa}, 10)).Bytes() | ||
namespaceB := namespace.MustNewV0(bytes.Repeat([]byte{0xb}, 10)).Bytes() | ||
|
||
blobA, err := NewBlob(appconsts.ShareVersionZero, namespaceA, []byte("dataA")) | ||
require.NoError(t, err) | ||
blobB, err := NewBlob(appconsts.ShareVersionZero, namespaceB, []byte("dataB")) | ||
require.NoError(t, err) | ||
|
||
got, err := BlobsToShares(blobB, blobA) | ||
require.NoError(t, err) | ||
assert.Equal(t, got[0][:appconsts.NamespaceSize], namespaceA) | ||
assert.Equal(t, got[1][:appconsts.NamespaceSize], namespaceB) | ||
assert.IsIncreasing(t, got) | ||
}) | ||
} | ||
|
||
func TestToAppBlobs(t *testing.T) { | ||
namespaceA := namespace.MustNewV0(bytes.Repeat([]byte{0xa}, 10)) | ||
namespaceB := namespace.MustNewV0(bytes.Repeat([]byte{0xb}, 10)) | ||
|
||
blobA, err := NewBlob(appconsts.ShareVersionZero, namespaceA.Bytes(), []byte("dataA")) | ||
require.NoError(t, err) | ||
blobB, err := NewBlob(appconsts.ShareVersionZero, namespaceB.Bytes(), []byte("dataB")) | ||
require.NoError(t, err) | ||
|
||
got := ToAppBlobs(blobA, blobB) | ||
want := []*squareblob.Blob{ | ||
{ | ||
NamespaceId: blobA.NamespaceId, | ||
NamespaceVersion: blobA.NamespaceVersion, | ||
Data: blobA.Data, | ||
ShareVersion: blobA.ShareVersion, | ||
}, | ||
{ | ||
NamespaceId: blobB.NamespaceId, | ||
NamespaceVersion: blobB.NamespaceVersion, | ||
Data: blobB.Data, | ||
ShareVersion: blobB.ShareVersion, | ||
}, | ||
} | ||
assert.Equal(t, want, got) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.