Skip to content
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

Standardize chain.Action.Marshal function #1198

Merged
merged 95 commits into from
Aug 30, 2024
Merged
Changes from 1 commit
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
92e08ec
naive first marshalling attemmpt
containerman17 Jul 24, 2024
6a3d006
int 8-int64 supported
containerman17 Jul 24, 2024
5618d6c
negative numbers support
containerman17 Jul 24, 2024
9fbd36c
support maps
containerman17 Jul 24, 2024
9b0c5c2
funky benchmark
containerman17 Jul 24, 2024
0f4d1c6
structs reflection caching attempt
containerman17 Jul 24, 2024
1c5b8a2
some fuzz tests
containerman17 Jul 24, 2024
fe39c66
fix speed comment
containerman17 Jul 24, 2024
66c86f8
relocate implementation out of test
containerman17 Jul 24, 2024
02c3643
benchmark
containerman17 Jul 24, 2024
8fb31da
rename test to TestMakeSureMarshalUnmarshalIsNotTooSlow
containerman17 Jul 24, 2024
acb7e45
fix fuzz test
containerman17 Jul 24, 2024
529d1c4
spec tests for js implant
containerman17 Jul 24, 2024
1a38839
update spec tests
containerman17 Jul 25, 2024
bfa9aea
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Jul 25, 2024
55e9bcd
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Jul 31, 2024
d31dc72
remove fuzz test
containerman17 Jul 31, 2024
5c08120
simplify to 2 types
containerman17 Jul 31, 2024
d7ec6e4
restore original logic
containerman17 Jul 31, 2024
103db88
rewrite marshal with avalanchego's wrappers.Packer
containerman17 Jul 31, 2024
2df75a4
pack bytes with uint32 and everything else with uint16
containerman17 Aug 1, 2024
c2c0e64
check for long arrays and strings, marshal maps with uint16
containerman17 Aug 1, 2024
3279d3d
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 1, 2024
0d62a73
update benchmark results
containerman17 Aug 1, 2024
1229c35
move to codec
containerman17 Aug 1, 2024
917335b
come back to codec.packer
containerman17 Aug 1, 2024
c7b49bd
speed up TestMakeSureMarshalUnmarshalIsNotTooSlow a bit
containerman17 Aug 1, 2024
dfe750b
support pointer to a struct
containerman17 Aug 1, 2024
1eada5e
auto marshaller integration
containerman17 Aug 1, 2024
6d48163
lint
containerman17 Aug 1, 2024
d78337a
remove a slow test breaking CI
containerman17 Aug 1, 2024
08ca5fa
fix linter errors
containerman17 Aug 1, 2024
a760610
faster reflection cache
containerman17 Aug 1, 2024
d0b9b33
minimize test to exclude testing errors
containerman17 Aug 1, 2024
2b61fee
unsafe type caching
containerman17 Aug 1, 2024
88ad966
simplify benchmark
containerman17 Aug 1, 2024
ebf421e
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 1, 2024
9d48156
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 2, 2024
364ea97
update benchmarks
containerman17 Aug 5, 2024
5aa6aa6
add benchmark results
containerman17 Aug 5, 2024
70f5185
add benchmem
containerman17 Aug 5, 2024
55e9e90
add benchmem results
containerman17 Aug 5, 2024
bc99331
deprecate string operations
containerman17 Aug 6, 2024
bbd80e0
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 14, 2024
2dcfe25
move empty address error
containerman17 Aug 14, 2024
38a6380
empty file
containerman17 Aug 14, 2024
efc1970
lint
containerman17 Aug 14, 2024
82cb7f8
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 15, 2024
f92b4f5
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 15, 2024
c2a7741
Merge branch 'containerman/standardize-marshal-function' of https://g…
containerman17 Aug 15, 2024
4146154
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 16, 2024
43d55f8
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 19, 2024
6b932ab
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 20, 2024
5370f77
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 21, 2024
30e4201
remove .prof
containerman17 Aug 21, 2024
2fdd6fe
correct 'marshall' to 'marshal' according to Go conventions
containerman17 Aug 21, 2024
cf0e771
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 22, 2024
b43de9a
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 23, 2024
0383d88
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 26, 2024
7ec6da9
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 27, 2024
a330078
simplify codec.Packer
containerman17 Aug 27, 2024
15b5a44
get chainid from tmpnet instead of the platform (#1458)
containerman17 Aug 27, 2024
630efb0
lint
containerman17 Aug 27, 2024
dc1a194
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 27, 2024
10c51b2
change to linearcodec
containerman17 Aug 27, 2024
2aaac18
lint
containerman17 Aug 27, 2024
66df721
go mod tidy
containerman17 Aug 27, 2024
e8aed2e
add serialize tag to Transfer
containerman17 Aug 27, 2024
4f02e00
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 28, 2024
b9406f3
remove unused errors
containerman17 Aug 28, 2024
0afbe10
auto size calculation
containerman17 Aug 28, 2024
22aec4b
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 29, 2024
9ffc111
minimizing changes
containerman17 Aug 29, 2024
be4e0bf
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 29, 2024
21e0a77
minimizing changes in packer_test
containerman17 Aug 29, 2024
7bbd1c4
minimize changes in packer test
containerman17 Aug 29, 2024
4c665c3
minimizing changes furtherr
containerman17 Aug 29, 2024
bfa7100
use explicit marshal and unmarshal methods
containerman17 Aug 29, 2024
00c6d62
add GetRegisteredTypes fun to registry
containerman17 Aug 29, 2024
b924105
bring back optional interface for marshal, add optional iface for size
containerman17 Aug 29, 2024
cfd6bfc
automatically generate unmarshal function
containerman17 Aug 29, 2024
88c317a
tx test nit
containerman17 Aug 29, 2024
619e9a0
single Marshaler iface
containerman17 Aug 29, 2024
80631b6
nit: comment
containerman17 Aug 29, 2024
61c56bb
keep chain.Marshaler implementation uncommented
containerman17 Aug 30, 2024
8c7e53b
rename HasTypeID to Typed
containerman17 Aug 30, 2024
292f815
nit: constants in action test
containerman17 Aug 30, 2024
559fe74
use actions.UnmarshalTransfer
containerman17 Aug 30, 2024
9badd2f
Merge branch 'main' into containerman/standardize-marshal-function
containerman17 Aug 30, 2024
94ae55d
lint
containerman17 Aug 30, 2024
c6de833
take interface in getActionSize and marshalActionInto funcs
containerman17 Aug 30, 2024
855145f
clean up actions_test
containerman17 Aug 30, 2024
71d8825
use consts for mockObjectSize and mockBytes in actions_test
containerman17 Aug 30, 2024
f08be88
mockObjectSize as var
containerman17 Aug 30, 2024
14a21d0
make mockObjectSize local var
containerman17 Aug 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
nit: constants in action test
  • Loading branch information
containerman17 authored Aug 30, 2024
commit 292f8156faa84ed2fd73e9158615bc12251c8a87
11 changes: 7 additions & 4 deletions chain/actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ type mockActionWithMarshaler struct {
mockAction
}

var mockManualSize = 100000
var mockManualBytes = []byte{1, 2, 3, 4, 5}

func (*mockActionWithMarshaler) Size() int {
return 100000
return mockManualSize
}

func (*mockActionWithMarshaler) Marshal(p *codec.Packer) {
p.PackFixedBytes([]byte{1, 2, 3, 4, 5})
p.PackFixedBytes(mockManualBytes)
}

func TestGetActionSize(t *testing.T) {
Expand All @@ -77,7 +80,7 @@ func TestGetActionSize(t *testing.T) {

size2, err := getActionSize(actionWithMarshaler)
require.NoError(err)
require.Equal(100000, size2)
require.Equal(mockManualSize, size2)
}

func TestMarshalActionInto(t *testing.T) {
Expand All @@ -94,5 +97,5 @@ func TestMarshalActionInto(t *testing.T) {
p2 := codec.NewWriter(0, consts.NetworkSizeLimit)
err = marshalActionInto(actionWithMarshaler, p2)
require.NoError(err)
require.Equal([]byte{1, 2, 3, 4, 5}, p2.Bytes())
require.Equal(mockManualBytes, p2.Bytes())
}