Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
0ad51ec1
Commit
0ad51ec1
authored
Apr 06, 2024
by
Levin Zimmermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proto fix, see comment in protogen
parent
d64f1baf
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1217 additions
and
340 deletions
+1217
-340
go/neo/proto/protogen.go
go/neo/proto/protogen.go
+30
-1
go/neo/proto/zproto-marshal.go
go/neo/proto/zproto-marshal.go
+1187
-339
No files found.
go/neo/proto/protogen.go
View file @
0ad51ec1
...
@@ -1735,7 +1735,36 @@ func (d *decoderM) genStructHead(path string, typ *types.Struct, userType types.
...
@@ -1735,7 +1735,36 @@ func (d *decoderM) genStructHead(path string, typ *types.Struct, userType types.
d
.
emit
(
"return 0, &mstructDecodeError{%q, op, opOk}"
,
d
.
pathName
(
path
))
d
.
emit
(
"return 0, &mstructDecodeError{%q, op, opOk}"
,
d
.
pathName
(
path
))
d
.
emit
(
"}"
)
d
.
emit
(
"}"
)
d
.
n
+=
1
// Arrays can have 1 or more bytes as a header:
//
// "Array format family stores a sequence of elements in 1, 3, or 5
// bytes of extra bytes in addition to the elements."
//
// see https://github.com/msgpack/msgpack/blob/master/spec.md
//
// Therefore it's better to use "ReadArrayHeaderBytes" than using
//
// >>> data = data[1:] // <- this fails in case we have array with 3 or 5 header bytes
//
// But there is another case, where this fix fails now, see:
//
// W0406 14:26:25.116792 2317874 mastered.go:127] C?: talk master(127.0.0.1:32747): C?: talk M1: after identification: expect nodeTab: 127.0.0.1:52480 - 127.0.0.1:32747 .0: decode: decode: M: NotifyNodeInformation.Addr: msgp: attempted to decode type "ext" with method for "array"
//
// So here we seem to use "genStructHead", because we create code for Addr decoding.
// But it doesn't work as expected, because we don't have an array, but an extension
// type. This means:
//
// Addr isn't an Array/Struct but an extension type and this needs to be adjusted in proto.go?
// We need to differentiate in 'genStructHead' between them?
d
.
emit
(
"{"
)
d
.
emit
(
"_, tail, err := msgp.ReadArrayHeaderBytes(data)"
)
d
.
emit
(
"if err != nil {"
)
d
.
emit
(
fmt
.
Sprintf
(
"return 0, mdecodeErr(%q, err)"
,
d
.
pathName
(
path
)))
d
.
emit
(
"}"
)
d
.
emit
(
"data = tail"
)
d
.
emit
(
"}"
)
d
.
overflow
.
Add
(
1
)
d
.
overflow
.
Add
(
1
)
}
}
...
...
go/neo/proto/zproto-marshal.go
View file @
0ad51ec1
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment