Skip to content

Commit 03e80e9

Browse files
authored
Merge pull request #417 from jovfer/master
[ST-628] Fix key in state proof parser for GET_FEES.
2 parents 6e29584 + 4aaf2ea commit 03e80e9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

libsovtoken/src/logic/parsers/parse_get_txn_fees.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use logic::parsers::common::{ResponseOperations, StateProof,
1212
KeyValuesInSP, KeyValueSimpleData, ParsedSP};
1313
use utils::json_conversion::JsonDeserialize;
1414
use utils::ffi_support::c_pointer_from_string;
15-
use utils::constants::txn_fields::FEES;
15+
use utils::constants::{general::FEES_STATE_KEY, txn_fields::FEES};
1616
use logic::type_aliases::{ProtocolVersion, TokenAmount, ReqId};
1717
use logic::parsers::common::KeyValueSimpleDataVerificationType;
1818

@@ -79,7 +79,7 @@ pub fn get_fees_state_proof_extractor(reply_from_node: *const c_char, parsed_sp:
7979

8080
// TODO: Make sure JSON serialisation preserves order
8181
let kvs_to_verify = KeyValuesInSP::Simple(KeyValueSimpleData {
82-
kvs: vec![(base64::encode(FEES), Some(fees.to_string()))],
82+
kvs: vec![(base64::encode(FEES_STATE_KEY), Some(fees.to_string()))],
8383
verification_type: KeyValueSimpleDataVerificationType::Simple
8484
});
8585
let proof_nodes = match state_proof.proof_nodes {
@@ -210,7 +210,7 @@ mod parse_fees_responses_test {
210210
let expected_parsed_sp = vec![ParsedSP {
211211
proof_nodes: String::from("29qFIGZlZXOT0pF7IjEiOjQsIjEwMDAxIjo4fQ=="),
212212
root_hash: String::from("5BU5Rc3sRtTJB6tVprGiTSqiRaa9o6ei11MjH4Vu16ms"),
213-
kvs_to_verify: KeyValuesInSP::Simple(KeyValueSimpleData { kvs: vec![(base64::encode("fees"), Some(json!({"1": 4, "10001": 8}).to_string()))], verification_type: KeyValueSimpleDataVerificationType::Simple }),
213+
kvs_to_verify: KeyValuesInSP::Simple(KeyValueSimpleData { kvs: vec![(base64::encode("200:fees"), Some(json!({"1": 4, "10001": 8}).to_string()))], verification_type: KeyValueSimpleDataVerificationType::Simple }),
214214
multi_signature: json!({
215215
"participants": ["Gamma", "Delta", "Beta"],
216216
"value": {"timestamp": 1530059419, "state_root_hash": "5BU5Rc3sRtTJB6tVprGiTSqiRaa9o6ei11MjH4Vu16ms", "ledger_id": 2, "txn_root_hash": "AKboMiJZJm247Sa7GsKQo5Ba8ukgxTQ3DsLc2pyVuDkU", "pool_state_root_hash": "J3ATG63R2JKHDCdpKpQf81FTNyQg2Vgz7Pu1ZHZw6zNy"}, "signature": "Qk67ePVhxdjHivAf8H4Loy1hN5zfb1dq79VSJKYx485EAXmj44PASpp8gj2faysdN8CNzSoUVvXgd3U4P2CA7VkwD7FHKUuviAFJfRQ68FnpUS8hVuqn6PAuv9RGUobohcJnKJ8CVKxr5i3Zn2JNXbk7AqeYRZQ2egq8fdoP3woPW7"

libsovtoken/src/utils/constants/general.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ pub static TXO_QUALIFIER: &str = "txo:sov:";
99
pub const PROTOCOL_VERSION: u32 = 2;
1010
pub const LEDGER_ID: &str = "1001";
1111

12+
pub const FEES_STATE_KEY: &'static str = "200:fees";
13+
1214
/**
1315
Defines a callback to communicate results to Indy-sdk as type
1416

0 commit comments

Comments
 (0)