Skip to content

Commit

Permalink
Fixed BlockState ConfirmedCount not of the right type, should hav…
Browse files Browse the repository at this point in the history
…e been a `[]uint8`
  • Loading branch information
Matthieu Vachon committed May 6, 2020
1 parent edcf181 commit 85d059b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Expand Up @@ -6,8 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- `TimePoint` will decode with `0` nanoseconds, when the `fitNodeos` flag is set on the ABI.
- Ability to decode a `int128` and `uint128` in decimal format when `fitNodeos` flag is set on the ABI
- `TimePoint` will decode with `0` nanoseconds, when the `fitNodeos` flag is set on the ABI.
- Ability to decode a `int128` and `uint128` in decimal format when `fitNodeos` flag is set on the ABI
- Ability to decode nested `arrays` in ABI decoder.
- Added `BlockState.Header` field of type `SignedBlockHeader` that was previously missing from the struct definition.
- Added `BlockState.AdditionalSignatures` field of type `[]ecc.Signature` that was previously missing from the struct definition.
Expand All @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `BlockState.ProducerToLastImpliedIRB` is now `[]PairAccountNameBlockNum`, was previously `[][2]EOSNameOrUint32`.
- `BlockState.BlockID` is now a `Checksum256`, was previously `string`.
- `BlockState.ActivatedProtocolFeatures` is now a `*ProtocolFeatureActivationSet`, was previously `map[string][]HexBytes`.
- `BlockState.ConfirmCount` is now a `[]uint8`, was previously `[]uint32`.
- `PendingSchedule.ScheduleHash` is now a `Checksum256`, was previously `HexBytes`.
- `ActionTraceReceipt.ActionDigest` is now a `Checksum256`, was previously `string`.
- `ActionTraceReceipt.CodeSequence` is now a `Varuint32`, was previously `Uint64`.
Expand Down
6 changes: 4 additions & 2 deletions decoder_test.go
Expand Up @@ -369,8 +369,10 @@ func TestDecoder_Empty_Signature(t *testing.T) {
}

func TestDecoder_BlockState(t *testing.T) {
hexString := "12000000120000001100000000000000010000000000ea305500010000000100023cd6a339e452311cb809c71d6652f67c388579004128aee87f623d201e61170e0100030000001104f2e04ac6caf545add296c46d6adfac2ac96190fe4b04f8bbec6a525f62ff1fce4412629c25e9eed6c7a235202f6666c1062e62559af5b0d9442d6a6f1ab6bd9ace48d4a174bf44582d64e738c7cc9f94573628f023c9791be418751100000000000000010000000000ea305512000000010000000000ea30551100000000010000000100023cd6a339e452311cb809c71d6652f67c388579004128aee87f623d201e61170e01000000000012b518a7d08697f9b5a3899d549d0393331c83a91af5c3ab362254c174fd34864b0000000000ea305500000000001104f2e04ac6caf545add296c46d6adfac2ac96190fe4b04f8bbec6a529070367f85cb9bf5144da126a59b13822df98aec0b8df5b41d9117d04f871dc52b09133824ea7518fedfd10cbebe38a79c0bc1f2752ca0d2e93319c88813f999000000000000001f2815130a419a1ecc5ea3a98ee00b5482f6b908c2dd40d6a7fb3801e6d8a5a08d1436cd98f2ebdb642c987a59e2d4fe1a32427b39bd504f145dc853bc9f0a6a90000000002f74e78d3382fdadcbbdb7b111ca91efeea4109d59ac94945951fca6c498aef6000000000001000001fd34864b0000000000ea305500000000001104f2e04ac6caf545add296c46d6adfac2ac96190fe4b04f8bbec6a529070367f85cb9bf5144da126a59b13822df98aec0b8df5b41d9117d04f871dc52b09133824ea7518fedfd10cbebe38a79c0bc1f2752ca0d2e93319c88813f999000000000000001f2815130a419a1ecc5ea3a98ee00b5482f6b908c2dd40d6a7fb3801e6d8a5a08d1436cd98f2ebdb642c987a59e2d4fe1a32427b39bd504f145dc853bc9f0a6a900100e94300002a01010020198466d49ea8763e341f3c5a9ae22b26386049cbc997347ed0bc2eb2b8e2dba51740ff906baf06f620df575b51ab2c72fad0c979a4a967b8b0abc8e3c51630250000a1021b5e305e1000dc1f790300000000030000000000ea305500409e9a2264b89a011052546ea998b33900000000a8ed3232661052546ea998b3392052546ea998b339010000000100023cd6a339e452311cb809c71d6652f67c388579004128aee87f623d201e61170e01000000010000000100023cd6a339e452311cb809c71d6652f67c388579004128aee87f623d201e61170e010000000000000000ea305500003f2a1ba6a24a011052546ea998b33900000000a8ed3232311052546ea998b3392052546ea998b339102700000000000004454f5300000000102700000000000004454f5300000000010000000000ea305500b0cafe4873bd3e011052546ea998b33900000000a8ed3232141052546ea998b3392052546ea998b33900200000000000"
rawData, err := hex.DecodeString(hexString)
hexString, err := ioutil.ReadFile("testdata/block_state_1.hex")
require.NoError(t, err)

rawData, err := hex.DecodeString(string(hexString))
require.NoError(t, err)

decoder := NewDecoder(rawData)
Expand Down
2 changes: 1 addition & 1 deletion p2ptypes.go
Expand Up @@ -290,7 +290,7 @@ type BlockState struct {
// EOSIO 2.x
ValidBlockSigningAuthorityV2 *BlockSigningAuthority `json:"valid_block_signing_authority,omitempty"`

ConfirmCount []uint32 `json:"confirm_count,omitempty"`
ConfirmCount []uint8 `json:"confirm_count,omitempty"`

BlockID Checksum256 `json:"id"`
Header *SignedBlockHeader `json:"header,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions testdata/block_state_1.hex
@@ -0,0 +1 @@
12000000120000001100000000000000010000000000ea305500010000000100023cd6a339e452311cb809c71d6652f67c388579004128aee87f623d201e61170e0100030000001104f2e04ac6caf545add296c46d6adfac2ac96190fe4b04f8bbec6a525f62ff1fce4412629c25e9eed6c7a235202f6666c1062e62559af5b0d9442d6a6f1ab6bd9ace48d4a174bf44582d64e738c7cc9f94573628f023c9791be418751100000000000000010000000000ea305512000000010000000000ea30551100000000010000000100023cd6a339e452311cb809c71d6652f67c388579004128aee87f623d201e61170e01000000000012b518a7d08697f9b5a3899d549d0393331c83a91af5c3ab362254c174fd34864b0000000000ea305500000000001104f2e04ac6caf545add296c46d6adfac2ac96190fe4b04f8bbec6a529070367f85cb9bf5144da126a59b13822df98aec0b8df5b41d9117d04f871dc52b09133824ea7518fedfd10cbebe38a79c0bc1f2752ca0d2e93319c88813f999000000000000001f2815130a419a1ecc5ea3a98ee00b5482f6b908c2dd40d6a7fb3801e6d8a5a08d1436cd98f2ebdb642c987a59e2d4fe1a32427b39bd504f145dc853bc9f0a6a90000000002f74e78d3382fdadcbbdb7b111ca91efeea4109d59ac94945951fca6c498aef6000000000001000001fd34864b0000000000ea305500000000001104f2e04ac6caf545add296c46d6adfac2ac96190fe4b04f8bbec6a529070367f85cb9bf5144da126a59b13822df98aec0b8df5b41d9117d04f871dc52b09133824ea7518fedfd10cbebe38a79c0bc1f2752ca0d2e93319c88813f999000000000000001f2815130a419a1ecc5ea3a98ee00b5482f6b908c2dd40d6a7fb3801e6d8a5a08d1436cd98f2ebdb642c987a59e2d4fe1a32427b39bd504f145dc853bc9f0a6a900100e94300002a01010020198466d49ea8763e341f3c5a9ae22b26386049cbc997347ed0bc2eb2b8e2dba51740ff906baf06f620df575b51ab2c72fad0c979a4a967b8b0abc8e3c51630250000a1021b5e305e1000dc1f790300000000030000000000ea305500409e9a2264b89a011052546ea998b33900000000a8ed3232661052546ea998b3392052546ea998b339010000000100023cd6a339e452311cb809c71d6652f67c388579004128aee87f623d201e61170e01000000010000000100023cd6a339e452311cb809c71d6652f67c388579004128aee87f623d201e61170e010000000000000000ea305500003f2a1ba6a24a011052546ea998b33900000000a8ed3232311052546ea998b3392052546ea998b339102700000000000004454f5300000000102700000000000004454f5300000000010000000000ea305500b0cafe4873bd3e011052546ea998b33900000000a8ed3232141052546ea998b3392052546ea998b33900200000000000

0 comments on commit 85d059b

Please sign in to comment.