Skip to content

Commit

Permalink
Added protocol_version to InfoGetStatusResult (#108)
Browse files Browse the repository at this point in the history
* Added protocol_version to InfoGetStatusResult response
  • Loading branch information
ZhmakAS authored Aug 6, 2024
1 parent 963249d commit 356fe5c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion rpc/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ func (b InfoGetValidatorChangesResult) GetRawJSON() json.RawMessage {
type InfoGetStatusResult struct {
// The RPC API version.
APIVersion string `json:"api_version"`
// The protocol version running in the node
ProtocolVersion string `json:"protocol_version"`
// The compiled node version.
BuildVersion string `json:"build_version"`
// The chainspec name, used to identify the currently connected network.
Expand Down Expand Up @@ -509,7 +511,7 @@ func (b QueryBalanceDetailsResult) GetRawJSON() json.RawMessage {
type InfoGetRewardResult struct {
APIVersion string `json:"api_version"`
DelegationRate float32 `json:"delegation_rate"`
EraID uint32 `json:"era_id"`
EraID uint64 `json:"era_id"`
RewardAmount clvalue.UInt512 `json:"reward_amount"`

rawJSON json.RawMessage
Expand Down
1 change: 1 addition & 0 deletions tests/data/rpc_response/get_status.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "1",
"result": {
"api_version": "2.0.0",
"protocol_version": "5.4.3",
"peers": [
{
"node_id": "tls:4cca..587b",
Expand Down
1 change: 1 addition & 0 deletions tests/rpc/client_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ func Test_Client_RPCGetStatus_WithAuthorizationHeader(t *testing.T) {
status, err := client.GetStatus(context.Background())
require.NoError(t, err)
assert.Equal(t, "2.0.0", status.APIVersion)
assert.Equal(t, "5.4.3", status.ProtocolVersion)
assert.NotEmpty(t, status.LatestSwitchBlockHash)
}
8 changes: 4 additions & 4 deletions types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Block struct {
StateRootHash key.Hash `json:"state_root_hash"`
LastSwitchBlockHash key.Hash `json:"last_switch_block_hash"`
ParentHash key.Hash `json:"parent_hash"`
EraID uint32 `json:"era_id"`
EraID uint64 `json:"era_id"`
Timestamp Timestamp `json:"timestamp"`
AccumulatedSeed *key.Hash `json:"accumulated_seed,omitempty"`
RandomBit bool `json:"random_bit"`
Expand Down Expand Up @@ -143,7 +143,7 @@ type BlockHeaderWrapper struct {
type BlockHeader struct {
AccumulatedSeed *key.Hash `json:"accumulated_seed,omitempty"`
BodyHash key.Hash `json:"body_hash"`
EraID uint32 `json:"era_id"`
EraID uint64 `json:"era_id"`
CurrentGasPrice uint8 `json:"current_gas_price"`
Height uint64 `json:"height"`
ParentHash key.Hash `json:"parent_hash"`
Expand Down Expand Up @@ -206,7 +206,7 @@ func NewBlockHeaderFromV2(header BlockHeaderV2) BlockHeader {
type BlockHeaderV1 struct {
AccumulatedSeed *key.Hash `json:"accumulated_seed,omitempty"`
BodyHash key.Hash `json:"body_hash"`
EraID uint32 `json:"era_id"`
EraID uint64 `json:"era_id"`
Height uint64 `json:"height"`
ParentHash key.Hash `json:"parent_hash"`
ProtocolVersion string `json:"protocol_version,omitempty"`
Expand Down Expand Up @@ -275,7 +275,7 @@ type BlockBodyV2 struct {
type BlockHeaderV2 struct {
AccumulatedSeed *key.Hash `json:"accumulated_seed,omitempty"`
BodyHash key.Hash `json:"body_hash"`
EraID uint32 `json:"era_id"`
EraID uint64 `json:"era_id"`
CurrentGasPrice uint8 `json:"current_gas_price"`
Height uint64 `json:"height"`
ParentHash key.Hash `json:"parent_hash"`
Expand Down
2 changes: 1 addition & 1 deletion types/minimal_block_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

type MinimalBlockInfo struct {
Creator keypair.PublicKey `json:"creator"`
EraID uint32 `json:"era_id"`
EraID uint64 `json:"era_id"`
Hash key.Hash `json:"hash"`
Height uint32 `json:"height"`
StateRootHash key.Hash `json:"state_root_hash"`
Expand Down

0 comments on commit 356fe5c

Please sign in to comment.