Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvanin committed Feb 18, 2020
2 parents 7f30447 + 04ead03 commit 11a0198
Show file tree
Hide file tree
Showing 13 changed files with 731 additions and 99 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog
This is the changelog for NeoFS Proto
This is the changelog for NeoFS API

## [0.4.0] - 2020-02-18

### Added
- Meta header for all gRPC responses. It contains epoch stamp and version number.
### Changed
- Endianness in accounting cheque. Now it uses little endian for cheaper
decoding in neofs smart-contract.

## [0.3.2] - 2020-02-10

Expand Down Expand Up @@ -189,3 +197,4 @@ Initial public release
[0.3.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.14...v0.3.0
[0.3.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.0...v0.3.1
[0.3.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.1...v0.3.2
[0.4.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.2...v0.4.0
2 changes: 1 addition & 1 deletion accounting/fixtures/cheque.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

CHEQUE=d6520dabb6cb9b981792608c73670eff14775e9a65bbc189271723ba2703c53263e8d6e522dc32203339dcd8eee9c6b7439a0000000053724e000000000000001e61000603012d47e76210aec73be39ab3d186e0a40fe8d86bfa3d4fabfda57ba13b88f96abe1de4c7ecd46cb32081c0ff199e0b32708d2ce709dd146ce096484073a9b15a259ca799f8d848eb5bea16f6d0842a0181ccd47384af2cdb0fd0af0819e8a08802f7528ce97c9a93558efe7d4f62577aabdf771c931f54a71be6ad21e7d9cc1777686ad19b5dc4b80d7b8decf90054c5aad66c0e6fe63d8473b751cd77c1bd0557516e0f3e7d0ccb485809023b0c08a89f33ae38b2f99ce3f1ebc7905dddf0ed0f023e00f03a16e8707ce045eb42ee80d392451541ee510dc18e1c8befbac54d7426087d37d32d836537d317deafbbd193002a36f80fbdfbf3a730cf011bc6c75c7e6d5724f3adee7015fcb3068d321e2ae555e79107be0c46070efdae2f724dbc9f0340750b92789821683283bcb98e32b7e032b94f267b6964613fc31a7ce5813fddeea47a1db525634237e924178b5c8ea745549ae60aa3570ce6cf52e370e6ab87652bdf8a179176f1acaf48896bef9ab300818a53f410d86241d506a550f4915403fef27f744e829131d0ec980829fafa51db1714c2761d9f78762c008c323e9d6612e4f9efdc609f191fd9ca5431dd9dc037130150107ab8769780d728e9ffdf314019b57c8d2b940b9ec078afa951ed8b06c1bf352edd2037e29b8f24cca3ec700368a6f5829fb2a34fa03d0308ae6b05f433f2904d9a852fed1f5d2eb598ca79475b74ef6394e712d275cd798062c6d8e41fad822ac5a4fcb167f0a2e196f61f9f65a0adef9650f49150e7eb7bb08dd1739fa6e86b341f1b2cf5657fcd200637e8
CHEQUE=7849b02d01cc7f7734295fa815ea64ec4d2012e45b8781eb891723ba2703c53263e8d6e522dc32203339dcd8eee9c6b7439a00ea56fa00000000611e000000000000060003012d47e76210aec73be39ab3d186e0a40fe8d86bfa3d4fabfda57ba13b88f96a8ebe4360627a1326f13fb9516c0dbc4af90f116e44bd33f4d04a0d1633afa243ad4f2fa9cd933e7631a619b5132cec6983906aba757af5590434124b232a43e302f7528ce97c9a93558efe7d4f62577aabdf771c931f54a71be6ad21e7d9cc177744b4b9781cf0c29adb503f33d2df9f810ebf33a774849848984cf7e2bbebd48ef0cd8592fbf9b6aee1dc74803e31c95a02dbbd5fd9783f9ecbcbf444b5942f830368a6f5829fb2a34fa03d0308ae6b05f433f2904d9a852fed1f5d2eb598ca794770adb1ece9dccd1c7ad98f709cfb890e3bdd5973dcdd838111fae2efa4c3c09ea2133e5d7c6eac6ae24afcce46db7c9f4dc154f123c835adff4e0b7e19bcffda0340750b92789821683283bcb98e32b7e032b94f267b6964613fc31a7ce5813fddad8298f71dfdc4f9b3e353f969727af476d43b12a25727cf6b9c73ae7152266d995bec807068ad2156288c4d946aeb17ebca787d498a1b87b9dae1bcd935763403fef27f744e829131d0ec980829fafa51db1714c2761d9f78762c008c323e9d66db9b5086d355897e52fe065e14f1cc70334248349aa4c7a3e6e3dc8f8693b1511c73dc88e6d6e8b6c6c68de922f351b5b1543917af2f2a3588aebfbd1ff3fac6023e00f03a16e8707ce045eb42ee80d392451541ee510dc18e1c8befbac54d742648b58f379b5337d9b74c5a61afb8ef3db7f3eb0454d6823777b613a3ee22cd6ce47e4fa72170d49267b773cc09c123654e0bcd7278aa2ae1e7c85d049b557a3c
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

echo $CHEQUE | xxd -p -r > $DIR/cheque_data
Expand Down
Binary file modified accounting/fixtures/cheque_data
Binary file not shown.
12 changes: 6 additions & 6 deletions accounting/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ func (b *Cheque) marshalBody() []byte {
offset += copy(buf, b.ID.Bytes())
offset += copy(buf[offset:], b.Owner.Bytes())

binary.BigEndian.PutUint64(buf[offset:], uint64(b.Amount.Value))
binary.LittleEndian.PutUint64(buf[offset:], uint64(b.Amount.Value))
offset += u64size

binary.BigEndian.PutUint64(buf[offset:], b.Height)
binary.LittleEndian.PutUint64(buf[offset:], b.Height)

return buf
}
Expand All @@ -199,13 +199,13 @@ func (b *Cheque) unmarshalBody(buf []byte) error {
}

{ // unmarshal amount
amount := int64(binary.BigEndian.Uint64(buf[offset:]))
amount := int64(binary.LittleEndian.Uint64(buf[offset:]))
b.Amount = decimal.New(amount)
offset += u64size
}

{ // unmarshal height
b.Height = binary.BigEndian.Uint64(buf[offset:])
b.Height = binary.LittleEndian.Uint64(buf[offset:])
offset += u64size
}

Expand All @@ -220,7 +220,7 @@ func (b Cheque) MarshalBinary() ([]byte, error) {
offset = copy(buf, b.marshalBody())
)

binary.BigEndian.PutUint16(buf[offset:], uint16(count))
binary.LittleEndian.PutUint16(buf[offset:], uint16(count))
offset += u16size

for _, sign := range b.Signatures {
Expand All @@ -246,7 +246,7 @@ func (b *Cheque) UnmarshalBinary(buf []byte) error {

body := buf[:signaturesOffset]

count := int64(binary.BigEndian.Uint16(buf[signaturesOffset:]))
count := int64(binary.LittleEndian.Uint16(buf[signaturesOffset:]))
offset := signaturesOffset + u16size

if ln := count * int64(crypto.PublicKeyCompressedSize+crypto.RFC6979SignatureSize); ln > int64(len(buf[offset:])) {
Expand Down
2 changes: 2 additions & 0 deletions accounting/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,7 @@ func TestCheque(t *testing.T) {
require.Equal(t, expect, actual)

require.NoError(t, cheque.Verify())
require.Equal(t, cheque.Height, uint64(7777))
require.Equal(t, cheque.Amount, decimal.NewGAS(42))
})
}
10 changes: 10 additions & 0 deletions docs/object.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ DeleteResponse is empty because we cannot guarantee permanent object removal
in distributed system.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) |


<a name="object.GetRangeHashRequest"></a>

Expand All @@ -186,6 +190,7 @@ in distributed system.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| Hashes | [bytes](#bytes) | repeated | Hashes is a homomorphic hashes of all ranges |
| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) |


<a name="object.GetRangeRequest"></a>
Expand All @@ -211,6 +216,7 @@ in distributed system.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| Fragment | [bytes](#bytes) | | Fragment of object's payload |
| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) |


<a name="object.GetRequest"></a>
Expand All @@ -237,6 +243,7 @@ in distributed system.
| ----- | ---- | ----- | ----------- |
| object | [Object](#object.Object) | | Object header and some payload |
| Chunk | [bytes](#bytes) | | Chunk of remaining payload |
| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) |


<a name="object.HeadRequest"></a>
Expand All @@ -263,6 +270,7 @@ in distributed system.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| Object | [Object](#object.Object) | | Object without payload |
| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) |


<a name="object.PutRequest"></a>
Expand Down Expand Up @@ -300,6 +308,7 @@ in distributed system.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) |
| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) |


<a name="object.SearchRequest"></a>
Expand All @@ -326,6 +335,7 @@ in distributed system.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| Addresses | [refs.Address](#refs.Address) | repeated | Addresses of found objects |
| Meta | [service.ResponseMetaHeader](#service.ResponseMetaHeader) | | ResponseMetaHeader contains meta information based on request processing by server (should be embedded into message) |

<!-- end messages -->

Expand Down
14 changes: 14 additions & 0 deletions docs/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

- Messages
- [RequestMetaHeader](#service.RequestMetaHeader)
- [ResponseMetaHeader](#service.ResponseMetaHeader)


- [service/verify.proto](#service/verify.proto)
Expand Down Expand Up @@ -49,6 +50,19 @@ RequestMetaHeader contains information about request meta headers
| Epoch | [uint64](#uint64) | | Epoch for user can be empty, because node sets epoch to the actual value |
| Version | [uint32](#uint32) | | Version defines protocol version TODO: not used for now, should be implemented in future |


<a name="service.ResponseMetaHeader"></a>

### Message ResponseMetaHeader
ResponseMetaHeader contains meta information based on request processing by server
(should be embedded into message)


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| Epoch | [uint64](#uint64) | | Current NeoFS epoch on server |
| Version | [uint32](#uint32) | | Version defines protocol version TODO: not used for now, should be implemented in future |

<!-- end messages -->

<!-- end enums -->
Expand Down
Loading

0 comments on commit 11a0198

Please sign in to comment.