From b3ad468ef71d0695c38d179e7fd7c6b8a88ad14c Mon Sep 17 00:00:00 2001 From: higherordertech Date: Mon, 5 Aug 2024 14:15:41 +1000 Subject: [PATCH 1/5] fix: P-717 use > instead of >= in amount VC first assertion clause --- .../assertion-build-v2/src/token_holding_amount/mod.rs | 4 ++-- .../src/nodereal/amount_holding/evm_amount_holding.rs | 2 +- .../core/credentials-v2/src/token_holding_amount/mod.rs | 7 +++++-- .../litentry/core/credentials/src/brc20/amount_holder.rs | 7 +++++-- .../core/credentials/src/litentry_profile/token_balance.rs | 6 +++++- .../src/nodereal/amount_holding/evm_amount_holding.rs | 7 +++++-- .../core/credentials/src/nodereal/bnb_domain/mod.rs | 7 +++++-- 7 files changed, 28 insertions(+), 12 deletions(-) diff --git a/tee-worker/litentry/core/assertion-build-v2/src/token_holding_amount/mod.rs b/tee-worker/litentry/core/assertion-build-v2/src/token_holding_amount/mod.rs index 4082d9f593..59e956de3b 100644 --- a/tee-worker/litentry/core/assertion-build-v2/src/token_holding_amount/mod.rs +++ b/tee-worker/litentry/core/assertion-build-v2/src/token_holding_amount/mod.rs @@ -447,7 +447,7 @@ mod tests { create_network_address_assertion_logics(Web3TokenType::Nfp), Box::new(AssertionLogic::Item { src: "$holding_amount".into(), - op: Op::GreaterEq, + op: Op::GreaterThan, dst: "0".into() }), Box::new(AssertionLogic::Item { @@ -483,7 +483,7 @@ mod tests { create_network_address_assertion_logics(Web3TokenType::Nfp), Box::new(AssertionLogic::Item { src: "$holding_amount".into(), - op: Op::GreaterEq, + op: Op::GreaterThan, dst: "0".into() }), Box::new(AssertionLogic::Item { diff --git a/tee-worker/litentry/core/assertion-build/src/nodereal/amount_holding/evm_amount_holding.rs b/tee-worker/litentry/core/assertion-build/src/nodereal/amount_holding/evm_amount_holding.rs index a316c996ad..638a046244 100644 --- a/tee-worker/litentry/core/assertion-build/src/nodereal/amount_holding/evm_amount_holding.rs +++ b/tee-worker/litentry/core/assertion-build/src/nodereal/amount_holding/evm_amount_holding.rs @@ -226,7 +226,7 @@ mod tests { create_ton_network_assertion_logic(), Box::new(AssertionLogic::Item { src: "$holding_amount".into(), - op: Op::GreaterEq, + op: Op::GreaterThan, dst: "0".into() }), Box::new(AssertionLogic::Item { diff --git a/tee-worker/litentry/core/credentials-v2/src/token_holding_amount/mod.rs b/tee-worker/litentry/core/credentials-v2/src/token_holding_amount/mod.rs index 24451ba6bb..881fb58552 100644 --- a/tee-worker/litentry/core/credentials-v2/src/token_holding_amount/mod.rs +++ b/tee-worker/litentry/core/credentials-v2/src/token_holding_amount/mod.rs @@ -86,8 +86,11 @@ fn update_assertion(token_type: Web3TokenType, balance: f64, credential: &mut Cr Some(index) => { let min = format!("{}", token_holding_amount_range[index]); let max = format!("{}", token_holding_amount_range[index + 1]); - let min_item = - AssertionLogic::new_item(ASSERTION_KEYS.holding_amount, Op::GreaterEq, &min); + let min_item = AssertionLogic::new_item( + ASSERTION_KEYS.holding_amount, + if index == 0 { Op::GreaterThan } else { Op::GreaterEq }, + &min, + ); let max_item = AssertionLogic::new_item(ASSERTION_KEYS.holding_amount, Op::LessThan, &max); diff --git a/tee-worker/litentry/core/credentials/src/brc20/amount_holder.rs b/tee-worker/litentry/core/credentials/src/brc20/amount_holder.rs index 770615ab44..085e1a7809 100644 --- a/tee-worker/litentry/core/credentials/src/brc20/amount_holder.rs +++ b/tee-worker/litentry/core/credentials/src/brc20/amount_holder.rs @@ -150,8 +150,11 @@ fn update_assertion(token: &BRC20Token, balance: f64, credential: &mut Credentia Some(index) => { let min = format!("{}", range[index]); let max = format!("{}", range[index + 1]); - let min_item = - AssertionLogic::new_item(ASSERTION_KEYS.holding_amount, Op::GreaterEq, &min); + let min_item = AssertionLogic::new_item( + ASSERTION_KEYS.holding_amount, + if index == 0 { Op::GreaterThan } else { Op::GreaterEq }, + &min, + ); let max_item = AssertionLogic::new_item(ASSERTION_KEYS.holding_amount, Op::LessThan, &max); diff --git a/tee-worker/litentry/core/credentials/src/litentry_profile/token_balance.rs b/tee-worker/litentry/core/credentials/src/litentry_profile/token_balance.rs index f5868742c3..043b71fe84 100644 --- a/tee-worker/litentry/core/credentials/src/litentry_profile/token_balance.rs +++ b/tee-worker/litentry/core/credentials/src/litentry_profile/token_balance.rs @@ -81,7 +81,11 @@ fn update_assertion(token: ETokenAddress, balance: f64, credential: &mut Credent Some(index) => { let min = format!("{}", range[index]); let max = format!("{}", range[index + 1]); - let min_item = AssertionLogic::new_item(content, Op::GreaterEq, &min); + let min_item = AssertionLogic::new_item( + content, + if index == 0 { Op::GreaterThan } else { Op::GreaterEq }, + &min, + ); let max_item = AssertionLogic::new_item(content, Op::LessThan, &max); assertion = assertion.add_item(min_item); diff --git a/tee-worker/litentry/core/credentials/src/nodereal/amount_holding/evm_amount_holding.rs b/tee-worker/litentry/core/credentials/src/nodereal/amount_holding/evm_amount_holding.rs index e590c61822..26a09b8d92 100644 --- a/tee-worker/litentry/core/credentials/src/nodereal/amount_holding/evm_amount_holding.rs +++ b/tee-worker/litentry/core/credentials/src/nodereal/amount_holding/evm_amount_holding.rs @@ -113,8 +113,11 @@ fn update_assertion(token_type: EVMTokenType, balance: f64, credential: &mut Cre Some(index) => { let min = format!("{}", &EVM_HOLDING_AMOUNT_RANGE[index]); let max = format!("{}", &EVM_HOLDING_AMOUNT_RANGE[index + 1]); - let min_item = - AssertionLogic::new_item(ASSERTION_KEYS.holding_amount, Op::GreaterEq, &min); + let min_item = AssertionLogic::new_item( + ASSERTION_KEYS.holding_amount, + if index == 0 { Op::GreaterThan } else { Op::GreaterEq }, + &min, + ); let max_item = AssertionLogic::new_item(ASSERTION_KEYS.holding_amount, Op::LessThan, &max); diff --git a/tee-worker/litentry/core/credentials/src/nodereal/bnb_domain/mod.rs b/tee-worker/litentry/core/credentials/src/nodereal/bnb_domain/mod.rs index 651ba32826..ab935958ad 100644 --- a/tee-worker/litentry/core/credentials/src/nodereal/bnb_domain/mod.rs +++ b/tee-worker/litentry/core/credentials/src/nodereal/bnb_domain/mod.rs @@ -41,8 +41,11 @@ pub trait RangeCredentialDetail { Some(index) => { let min = range[index - 1]; let max = range[index]; - let min_item = - AssertionLogic::new_item(breakdown, Op::GreaterEq, &format!("{}", min)); + let min_item = AssertionLogic::new_item( + breakdown, + if index == 0 { Op::GreaterThan } else { Op::GreaterEq }, + &format!("{}", min), + ); let max_item = AssertionLogic::new_item(breakdown, Op::LessThan, &format!("{}", max)); From b2d0d6e26c37ea25571fbe4e7be6a3f494eca620 Mon Sep 17 00:00:00 2001 From: higherordertech Date: Mon, 5 Aug 2024 14:16:23 +1000 Subject: [PATCH 2/5] fix: only use > 0 in clause when amount = 0 for amount assertion --- .../src/token_holding_amount/mod.rs | 5 ----- .../src/token_holding_amount/mod.rs | 8 +++++--- .../core/credentials/src/brc20/amount_holder.rs | 8 +++++--- .../core/credentials/src/credential_schema.rs | 16 ++++++++-------- .../src/litentry_profile/token_balance.rs | 6 ++++-- .../amount_holding/evm_amount_holding.rs | 8 +++++--- .../credentials/src/nodereal/bnb_domain/mod.rs | 10 +++++++--- 7 files changed, 34 insertions(+), 27 deletions(-) diff --git a/tee-worker/litentry/core/assertion-build-v2/src/token_holding_amount/mod.rs b/tee-worker/litentry/core/assertion-build-v2/src/token_holding_amount/mod.rs index 59e956de3b..f2e6112bec 100644 --- a/tee-worker/litentry/core/assertion-build-v2/src/token_holding_amount/mod.rs +++ b/tee-worker/litentry/core/assertion-build-v2/src/token_holding_amount/mod.rs @@ -449,11 +449,6 @@ mod tests { src: "$holding_amount".into(), op: Op::GreaterThan, dst: "0".into() - }), - Box::new(AssertionLogic::Item { - src: "$holding_amount".into(), - op: Op::LessThan, - dst: "1".into() }) ] } diff --git a/tee-worker/litentry/core/credentials-v2/src/token_holding_amount/mod.rs b/tee-worker/litentry/core/credentials-v2/src/token_holding_amount/mod.rs index 881fb58552..c0a7aeb7aa 100644 --- a/tee-worker/litentry/core/credentials-v2/src/token_holding_amount/mod.rs +++ b/tee-worker/litentry/core/credentials-v2/src/token_holding_amount/mod.rs @@ -91,11 +91,13 @@ fn update_assertion(token_type: Web3TokenType, balance: f64, credential: &mut Cr if index == 0 { Op::GreaterThan } else { Op::GreaterEq }, &min, ); - let max_item = - AssertionLogic::new_item(ASSERTION_KEYS.holding_amount, Op::LessThan, &max); assertion = assertion.add_item(min_item); - assertion = assertion.add_item(max_item); + if balance > 0_f64 { + let max_item = + AssertionLogic::new_item(ASSERTION_KEYS.holding_amount, Op::LessThan, &max); + assertion = assertion.add_item(max_item); + } credential.credential_subject.values.push(index != 0 || balance > 0_f64); }, diff --git a/tee-worker/litentry/core/credentials/src/brc20/amount_holder.rs b/tee-worker/litentry/core/credentials/src/brc20/amount_holder.rs index 085e1a7809..f390565a72 100644 --- a/tee-worker/litentry/core/credentials/src/brc20/amount_holder.rs +++ b/tee-worker/litentry/core/credentials/src/brc20/amount_holder.rs @@ -155,11 +155,13 @@ fn update_assertion(token: &BRC20Token, balance: f64, credential: &mut Credentia if index == 0 { Op::GreaterThan } else { Op::GreaterEq }, &min, ); - let max_item = - AssertionLogic::new_item(ASSERTION_KEYS.holding_amount, Op::LessThan, &max); assertion = assertion.add_item(min_item); - assertion = assertion.add_item(max_item); + if balance > 0_f64 { + let max_item = + AssertionLogic::new_item(ASSERTION_KEYS.holding_amount, Op::LessThan, &max); + assertion = assertion.add_item(max_item); + } credential.credential_subject.values.push(index != 0 || balance > 0_f64); }, diff --git a/tee-worker/litentry/core/credentials/src/credential_schema.rs b/tee-worker/litentry/core/credentials/src/credential_schema.rs index be4d9019e1..282861d912 100644 --- a/tee-worker/litentry/core/credentials/src/credential_schema.rs +++ b/tee-worker/litentry/core/credentials/src/credential_schema.rs @@ -52,10 +52,10 @@ pub fn get_schema_url(assertion: &Assertion) -> Option { Assertion::Achainable(params) => match params { AchainableParams::AmountHolding(_) => - Some(format!("{BASE_URL}/17-token-holding-amount/1-1-0.json")), + Some(format!("{BASE_URL}/17-token-holding-amount/1-1-2.json")), AchainableParams::AmountToken(_) => - Some(format!("{BASE_URL}/17-token-holding-amount/1-1-0.json")), + Some(format!("{BASE_URL}/17-token-holding-amount/1-1-2.json")), AchainableParams::Amount(_) => Some(format!("{BASE_URL}/11-token-holder/1-1-0.json")), @@ -86,10 +86,10 @@ pub fn get_schema_url(assertion: &Assertion) -> Option { Some(format!("{BASE_URL}/14-generic-discord-role/1-1-0.json")), Assertion::BnbDomainHolding => - Some(format!("{BASE_URL}/15-bnb-domain-holding-amount/1-1-0.json")), + Some(format!("{BASE_URL}/15-bnb-domain-holding-amount/1-1-1.json")), Assertion::BnbDigitDomainClub(_) => - Some(format!("{BASE_URL}/16-bnb-3d-4d-club-domain-holding-amount/1-1-0.json")), + Some(format!("{BASE_URL}/16-bnb-3d-4d-club-domain-holding-amount/1-1-1.json")), Assertion::VIP3MembershipCard(_) => Some(format!("{BASE_URL}/19-vip3-card-holder/1-1-0.json")), @@ -97,13 +97,13 @@ pub fn get_schema_url(assertion: &Assertion) -> Option { Assertion::WeirdoGhostGangHolder => Some(format!("{BASE_URL}/18-weirdoghostgang-holder/1-1-0.json")), - Assertion::LITStaking => Some(format!("{BASE_URL}/17-token-holding-amount/1-1-0.json")), + Assertion::LITStaking => Some(format!("{BASE_URL}/17-token-holding-amount/1-1-2.json")), Assertion::EVMAmountHolding(_) => - Some(format!("{BASE_URL}/21-evm-holding-amount/1-1-0.json")), + Some(format!("{BASE_URL}/21-evm-holding-amount/1-1-2.json")), Assertion::BRC20AmountHolder => - Some(format!("{BASE_URL}/20-token-holding-amount-list/1-1-0.json")), + Some(format!("{BASE_URL}/20-token-holding-amount-list/1-1-1.json")), Assertion::CryptoSummary => Some(format!("{BASE_URL}/23-crypto-summary/1-1-0.json")), @@ -112,7 +112,7 @@ pub fn get_schema_url(assertion: &Assertion) -> Option { Assertion::NftHolder(_) => Some(format!("{BASE_URL}/26-nft-holder/1-1-2.json")), Assertion::TokenHoldingAmount(_) => - Some(format!("{BASE_URL}/25-token-holding-amount/1-1-3.json")), + Some(format!("{BASE_URL}/25-token-holding-amount/1-1-4.json")), Assertion::Dynamic(..) => None, } diff --git a/tee-worker/litentry/core/credentials/src/litentry_profile/token_balance.rs b/tee-worker/litentry/core/credentials/src/litentry_profile/token_balance.rs index 043b71fe84..7b41ef043b 100644 --- a/tee-worker/litentry/core/credentials/src/litentry_profile/token_balance.rs +++ b/tee-worker/litentry/core/credentials/src/litentry_profile/token_balance.rs @@ -86,10 +86,12 @@ fn update_assertion(token: ETokenAddress, balance: f64, credential: &mut Credent if index == 0 { Op::GreaterThan } else { Op::GreaterEq }, &min, ); - let max_item = AssertionLogic::new_item(content, Op::LessThan, &max); assertion = assertion.add_item(min_item); - assertion = assertion.add_item(max_item); + if balance > 0_f64 { + let max_item = AssertionLogic::new_item(content, Op::LessThan, &max); + assertion = assertion.add_item(max_item); + } credential.credential_subject.values.push(index != 0 || balance > 0_f64); }, diff --git a/tee-worker/litentry/core/credentials/src/nodereal/amount_holding/evm_amount_holding.rs b/tee-worker/litentry/core/credentials/src/nodereal/amount_holding/evm_amount_holding.rs index 26a09b8d92..44b33faccb 100644 --- a/tee-worker/litentry/core/credentials/src/nodereal/amount_holding/evm_amount_holding.rs +++ b/tee-worker/litentry/core/credentials/src/nodereal/amount_holding/evm_amount_holding.rs @@ -118,11 +118,13 @@ fn update_assertion(token_type: EVMTokenType, balance: f64, credential: &mut Cre if index == 0 { Op::GreaterThan } else { Op::GreaterEq }, &min, ); - let max_item = - AssertionLogic::new_item(ASSERTION_KEYS.holding_amount, Op::LessThan, &max); assertion = assertion.add_item(min_item); - assertion = assertion.add_item(max_item); + if balance > 0_f64 { + let max_item = + AssertionLogic::new_item(ASSERTION_KEYS.holding_amount, Op::LessThan, &max); + assertion = assertion.add_item(max_item); + } credential.credential_subject.values.push(index != 0 || balance > 0_f64); }, diff --git a/tee-worker/litentry/core/credentials/src/nodereal/bnb_domain/mod.rs b/tee-worker/litentry/core/credentials/src/nodereal/bnb_domain/mod.rs index ab935958ad..bcde30d7a3 100644 --- a/tee-worker/litentry/core/credentials/src/nodereal/bnb_domain/mod.rs +++ b/tee-worker/litentry/core/credentials/src/nodereal/bnb_domain/mod.rs @@ -46,10 +46,14 @@ pub trait RangeCredentialDetail { if index == 0 { Op::GreaterThan } else { Op::GreaterEq }, &format!("{}", min), ); - let max_item = - AssertionLogic::new_item(breakdown, Op::LessThan, &format!("{}", max)); - vec![min_item, max_item] + if amount > 0 { + let max_item = + AssertionLogic::new_item(breakdown, Op::LessThan, &format!("{}", max)); + vec![min_item, max_item] + } else { + vec![min_item] + } }, None => { // >= last value From 6384f39d84199ebe2e35aa1e788a21e5bccf76aa Mon Sep 17 00:00:00 2001 From: higherordertech Date: Mon, 5 Aug 2024 19:27:09 +1000 Subject: [PATCH 3/5] fix: use > instead of >= in solidity amount VC first assertion clause, only use > 0 in clause when amount = 0 for solidity amount assertion --- .../token_holding_amount/TokenHoldingAmount.sol | 10 +++++++--- .../src/dynamic/tests/token-holding-amount.ts | 9 ++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenHoldingAmount.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenHoldingAmount.sol index 0369cd2f5a..ecfed404da 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenHoldingAmount.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenHoldingAmount.sol @@ -68,6 +68,7 @@ abstract contract TokenHoldingAmount is DynamicAssertion { string[] memory assertions = assembleAssertions( min, max, + balance, tokenLowercaseName ); @@ -134,12 +135,13 @@ abstract contract TokenHoldingAmount is DynamicAssertion { function assembleAssertions( uint256 min, int256 max, + uint256 balance, string memory tokenName ) private pure returns (string[] memory) { string memory variable = "$holding_amount"; AssertionLogic.CompositeCondition memory cc = AssertionLogic .CompositeCondition( - new AssertionLogic.Condition[](max > 0 ? 3 : 2), + new AssertionLogic.Condition[](max > 0 && balance > 0 ? 3 : 2), true ); AssertionLogic.andOp( @@ -153,10 +155,12 @@ abstract contract TokenHoldingAmount is DynamicAssertion { cc, 1, variable, - AssertionLogic.Op.GreaterEq, + min == 0 + ? AssertionLogic.Op.GreaterThan + : AssertionLogic.Op.GreaterEq, StringShift.toShiftedString(min, Constants.decimals_factor) ); - if (max > 0) { + if (max > 0 && balance > 0) { AssertionLogic.andOp( cc, 2, diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/tests/token-holding-amount.ts b/tee-worker/litentry/core/assertion-build/src/dynamic/tests/token-holding-amount.ts index d422acbc9f..cd7963518e 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/tests/token-holding-amount.ts +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/tests/token-holding-amount.ts @@ -54,14 +54,9 @@ describe('TokenHoldingAmount', () => { }, { src: '$holding_amount', - op: Op.GTE, + op: Op.GT, dst: '0', }, - { - src: '$holding_amount', - op: Op.LT, - dst: '1', - }, ], }, false @@ -118,7 +113,7 @@ describe('TokenHoldingAmount', () => { }, { src: '$holding_amount', - op: Op.GTE, + op: Op.GT, dst: '0', }, { From 5b711dc2bf9acea6d326e3afb55cfa364b7b9ed3 Mon Sep 17 00:00:00 2001 From: higherordertech Date: Mon, 5 Aug 2024 19:39:59 +1000 Subject: [PATCH 4/5] fix: update the schema url of solidity contract: TokenHoldingAmount --- .../contracts/token_holding_amount/TokenHoldingAmount.sol | 2 +- .../assertion-build/src/dynamic/tests/token-holding-amount.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenHoldingAmount.sol b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenHoldingAmount.sol index ecfed404da..2760f1c167 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenHoldingAmount.sol +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/TokenHoldingAmount.sol @@ -45,7 +45,7 @@ abstract contract TokenHoldingAmount is DynamicAssertion { string memory description = "The amount of a particular token you are holding"; string memory assertion_type = "Token Holding Amount"; - schema_url = "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/25-token-holding-amount/1-1-3.json"; + schema_url = "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/25-token-holding-amount/1-1-4.json"; string memory tokenLowercaseName = abi.decode(params, (string)); diff --git a/tee-worker/litentry/core/assertion-build/src/dynamic/tests/token-holding-amount.ts b/tee-worker/litentry/core/assertion-build/src/dynamic/tests/token-holding-amount.ts index cd7963518e..067401fb20 100644 --- a/tee-worker/litentry/core/assertion-build/src/dynamic/tests/token-holding-amount.ts +++ b/tee-worker/litentry/core/assertion-build/src/dynamic/tests/token-holding-amount.ts @@ -29,7 +29,7 @@ describe('TokenHoldingAmount', () => { await expectAssertionResult(contract, val, { tokenType: 'Token Holding Amount', tokenDesc: 'The amount of a particular token you are holding', - schemaUrl: assembleSchemaUrl('25-token-holding-amount/1-1-3.json'), + schemaUrl: assembleSchemaUrl('25-token-holding-amount/1-1-4.json'), assertions: [assertion], result, }) From 9f710d5d52e0c0c0c6aa2ea0da52a24e1172c9b5 Mon Sep 17 00:00:00 2001 From: higherordertech Date: Tue, 6 Aug 2024 20:19:29 +1000 Subject: [PATCH 5/5] fix: wrong op in first clause of bnb domain amount vc --- .../litentry/core/credentials/src/nodereal/bnb_domain/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tee-worker/litentry/core/credentials/src/nodereal/bnb_domain/mod.rs b/tee-worker/litentry/core/credentials/src/nodereal/bnb_domain/mod.rs index bcde30d7a3..a6dabffffd 100644 --- a/tee-worker/litentry/core/credentials/src/nodereal/bnb_domain/mod.rs +++ b/tee-worker/litentry/core/credentials/src/nodereal/bnb_domain/mod.rs @@ -43,7 +43,7 @@ pub trait RangeCredentialDetail { let max = range[index]; let min_item = AssertionLogic::new_item( breakdown, - if index == 0 { Op::GreaterThan } else { Op::GreaterEq }, + if index == 1 { Op::GreaterThan } else { Op::GreaterEq }, &format!("{}", min), );