-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: decrease namespace from 33 to 29 bytes #1771
Changes from all commits
e67db0b
c6c8bf3
bb3845a
1962981
8d26045
b96a5bd
6a9aea7
481a3d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -26,7 +26,7 @@ func TestNilDataAvailabilityHeaderHashDoesntCrash(t *testing.T) { | |||||||
|
||||||||
func TestMinDataAvailabilityHeader(t *testing.T) { | ||||||||
dah := MinDataAvailabilityHeader() | ||||||||
expectedHash := []byte{0xe9, 0x5, 0x28, 0x49, 0xf, 0x1d, 0x51, 0x67, 0x29, 0x2c, 0x1f, 0x1b, 0x83, 0xe1, 0x74, 0x2a, 0x27, 0x48, 0x17, 0x34, 0x12, 0xc9, 0x1d, 0xf7, 0xdd, 0x1, 0x96, 0x78, 0xa4, 0x62, 0xb9, 0x77} | ||||||||
expectedHash := []byte{0x3d, 0x96, 0xb7, 0xd2, 0x38, 0xe7, 0xe0, 0x45, 0x6f, 0x6a, 0xf8, 0xe7, 0xcd, 0xf0, 0xa6, 0x7b, 0xd6, 0xcf, 0x9c, 0x20, 0x89, 0xec, 0xb5, 0x59, 0xc6, 0x59, 0xdc, 0xaa, 0x1f, 0x88, 0x3, 0x53} | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Non Blocking][question] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good follow up to document this imo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I generate them by running the test after a share encoding change and copying the actual output to the expected output. Related doc: celestia-app/x/blob/types/payforblob_test.go Lines 64 to 66 in 207ec1a
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool 👍 |
||||||||
require.Equal(t, expectedHash, dah.hash) | ||||||||
require.NoError(t, dah.ValidateBasic()) | ||||||||
} | ||||||||
|
@@ -42,13 +42,13 @@ func TestNewDataAvailabilityHeader(t *testing.T) { | |||||||
tests := []test{ | ||||||||
{ | ||||||||
name: "typical", | ||||||||
expectedHash: []byte{0x5b, 0x27, 0x3e, 0x3a, 0x5d, 0x9e, 0x90, 0x25, 0x58, 0x21, 0xb7, 0xe0, 0x4d, 0x4b, 0xaa, 0xde, 0x37, 0xa6, 0x6f, 0xcc, 0xd, 0x16, 0x6f, 0x9e, 0xe0, 0x7f, 0xbe, 0x8, 0xb4, 0x41, 0xc8, 0xa6}, | ||||||||
expectedHash: []byte{0xb5, 0x6e, 0x4d, 0x25, 0x1a, 0xc2, 0x66, 0xf4, 0xb9, 0x1c, 0xc5, 0x46, 0x4b, 0x3f, 0xc7, 0xef, 0xcb, 0xdc, 0x88, 0x80, 0x64, 0x64, 0x74, 0x96, 0xd1, 0x31, 0x33, 0xf0, 0xdc, 0x65, 0xac, 0x25}, | ||||||||
squareSize: 2, | ||||||||
shares: generateShares(4), | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit] Can we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! #1788 |
||||||||
}, | ||||||||
{ | ||||||||
name: "max square size", | ||||||||
expectedHash: []byte{0xce, 0x5c, 0xf3, 0xc9, 0x15, 0xeb, 0xbf, 0xb0, 0x67, 0xe1, 0xa5, 0x97, 0x35, 0xf3, 0x25, 0x7b, 0x1c, 0x47, 0x74, 0x1f, 0xec, 0x6a, 0x33, 0x19, 0x7f, 0x8f, 0xc2, 0x4a, 0xe, 0xe2, 0xbe, 0x73}, | ||||||||
expectedHash: []byte{0xb, 0xd3, 0xab, 0xee, 0xac, 0xfb, 0xb0, 0xb9, 0x2d, 0xfb, 0xda, 0xc4, 0xa1, 0x54, 0x86, 0x8e, 0x3c, 0x4e, 0x79, 0x66, 0x6f, 0x7f, 0xcf, 0x6c, 0x62, 0xb, 0xb9, 0xd, 0xd3, 0xa0, 0xdc, 0xf0}, | ||||||||
squareSize: appconsts.MaxSquareSize, | ||||||||
shares: generateShares(appconsts.MaxSquareSize * appconsts.MaxSquareSize), | ||||||||
}, | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ func TestSplitTxs_forTxShares(t *testing.T) { | |
[]byte{ | ||
0x1, // info byte | ||
0x0, 0x0, 0x0, 0x2, // 1 byte (unit) + 1 byte (unit length) = 2 bytes sequence length | ||
0x0, 0x0, 0x0, 0x2a, // reserved bytes | ||
0x0, 0x0, 0x0, 0x26, // reserved bytes | ||
rootulp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
0x1, // unit length of first transaction | ||
0xa, // data of first transaction | ||
}..., | ||
|
@@ -57,7 +57,7 @@ func TestSplitTxs_forTxShares(t *testing.T) { | |
[]byte{ | ||
0x1, // info byte | ||
0x0, 0x0, 0x0, 0x4, // 2 bytes (first transaction) + 2 bytes (second transaction) = 4 bytes sequence length | ||
0x0, 0x0, 0x0, 0x2a, // reserved bytes | ||
0x0, 0x0, 0x0, 0x26, // reserved bytes | ||
0x1, // unit length of first transaction | ||
0xa, // data of first transaction | ||
0x1, // unit length of second transaction | ||
|
@@ -78,7 +78,7 @@ func TestSplitTxs_forTxShares(t *testing.T) { | |
[]byte{ | ||
0x1, // info byte | ||
0x0, 0x0, 0x2, 0x2, // 512 (unit) + 2 (unit length) = 514 sequence length | ||
0x0, 0x0, 0x0, 0x2a, // reserved bytes | ||
0x0, 0x0, 0x0, 0x26, // reserved bytes | ||
128, 4, // unit length of transaction is 512 | ||
}..., | ||
), | ||
|
@@ -94,7 +94,7 @@ func TestSplitTxs_forTxShares(t *testing.T) { | |
0x0, 0x0, 0x0, 0x0, // reserved bytes | ||
}..., | ||
), | ||
bytes.Repeat([]byte{0xc}, 44)..., // continuation data of transaction | ||
bytes.Repeat([]byte{0xc}, 40)..., // continuation data of transaction | ||
), | ||
}, | ||
), | ||
|
@@ -110,7 +110,7 @@ func TestSplitTxs_forTxShares(t *testing.T) { | |
[]byte{ | ||
0x1, // info byte | ||
0x0, 0x0, 0x2, 0x4, // 2 bytes (first transaction) + 514 bytes (second transaction) = 516 bytes sequence length | ||
0x0, 0x0, 0x0, 0x2a, // reserved bytes | ||
0x0, 0x0, 0x0, 0x26, // reserved bytes | ||
1, // unit length of first transaction | ||
0xa, // data of first transaction | ||
128, 4, // unit length of second transaction is 512 | ||
|
@@ -128,7 +128,7 @@ func TestSplitTxs_forTxShares(t *testing.T) { | |
0x0, 0x0, 0x0, 0x0, // reserved bytes | ||
}..., | ||
), | ||
bytes.Repeat([]byte{0xc}, 46)..., // continuation data of second transaction | ||
bytes.Repeat([]byte{0xc}, 42)..., // continuation data of second transaction | ||
), | ||
}, | ||
), | ||
|
@@ -144,7 +144,7 @@ func TestSplitTxs_forTxShares(t *testing.T) { | |
[]byte{ | ||
0x1, // info byte | ||
0x0, 0x0, 0x2, 0x4, // 514 bytes (first transaction) + 2 bytes (second transaction) = 516 bytes sequence length | ||
0x0, 0x0, 0x0, 0x2a, // reserved bytes | ||
0x0, 0x0, 0x0, 0x26, // reserved bytes | ||
128, 4, // unit length of first transaction is 512 | ||
}..., | ||
), | ||
|
@@ -156,10 +156,10 @@ func TestSplitTxs_forTxShares(t *testing.T) { | |
appns.TxNamespace.Bytes(), | ||
[]byte{ | ||
0x0, // info byte | ||
0x0, 0x0, 0x0, 0x52, // reserved bytes | ||
0x0, 0x0, 0x0, 0x4a, // reserved bytes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion, non-blocking] Could we include visual representations illustrating how the data is organized within their respective shares? by visual representation I mean something similar to the ones in this example. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, // continuation data of first transaction | ||
0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, // continuation data of first transaction | ||
0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, // continuation data of first transaction | ||
0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, // continuation data of first transaction | ||
1, // unit length of second transaction | ||
0xa, // data of second transaction | ||
}..., | ||
|
@@ -196,7 +196,7 @@ func TestSplitTxs(t *testing.T) { | |
[]byte{ | ||
0x1, // info byte | ||
0x0, 0x0, 0x0, 0x2, // 1 byte (unit) + 1 byte (unit length) = 2 bytes sequence length | ||
0x0, 0x0, 0x0, 0x2a, // reserved bytes | ||
0x0, 0x0, 0x0, 0x26, // reserved bytes | ||
0x1, // unit length of first transaction | ||
0xa, // data of first transaction | ||
}..., | ||
|
@@ -214,7 +214,7 @@ func TestSplitTxs(t *testing.T) { | |
[]uint8{ | ||
0x1, // info byte | ||
0x0, 0x0, 0x0, 13, // 1 byte (unit) + 1 byte (unit length) = 2 bytes sequence length | ||
0x0, 0x0, 0x0, 0x2a, // reserved bytes | ||
0x0, 0x0, 0x0, 0x26, // reserved bytes | ||
12, // unit length of first transaction | ||
0xa, 0x1, 0xb, 0x12, 0x1, 0xa, 0x1a, 0x4, 0x49, 0x4e, 0x44, 0x58, // data of first transaction | ||
}..., | ||
|
@@ -230,7 +230,7 @@ func TestSplitTxs(t *testing.T) { | |
[]uint8{ | ||
0x1, // info byte | ||
0x0, 0x0, 0x2, 0x2, // 512 (unit) + 2 (unit length) = 514 sequence length | ||
0x0, 0x0, 0x0, 0x2a, // reserved bytes | ||
0x0, 0x0, 0x0, 0x26, // reserved bytes | ||
128, 4, // unit length of transaction is 512 | ||
}..., | ||
), | ||
|
@@ -245,7 +245,7 @@ func TestSplitTxs(t *testing.T) { | |
0x0, 0x0, 0x0, 0x0, // reserved bytes | ||
}..., | ||
), | ||
bytes.Repeat([]byte{0xc}, 44)..., // continuation data of transaction | ||
bytes.Repeat([]byte{0xc}, 40)..., // continuation data of transaction | ||
), | ||
}, | ||
), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[non blocking]
This const is also defined in core, wouldn't it make sense to use it here instead of rehardcoding it here?