Skip to content

Commit

Permalink
[RDS-2179] fix:Use proper logic. (#4793)
Browse files Browse the repository at this point in the history
Fixes wrong assert.

---------

Co-authored-by: bartossh <[email protected]>
  • Loading branch information
bartossh and bartossh authored Feb 14, 2025
1 parent 3976e39 commit cb3dbd7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,9 @@ module redstone_sdk::validate {
vector::push_back(&mut seen_signers, *address);

count = count + 1;
if (count >= threshold) { return };
};

assert!(count < threshold, E_INSUFFICIENT_SIGNER_COUNT);
assert!(count >= threshold, E_INSUFFICIENT_SIGNER_COUNT);
}

// === Tests Functions ===
Expand Down Expand Up @@ -365,6 +364,7 @@ module redstone_sdk::validate {
}

#[test]
#[expected_failure(abort_code = E_SIGNER_DUPLICATED)]
fun test_verify_data_packages_fail_on_duplicated_packages_after_threshold_met() {
let config = test_config();
let timestamp = 1000;
Expand Down
4 changes: 2 additions & 2 deletions packages/movement-connector/scripts/sample-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { makeAptos } from "./utils";
async function main() {
const paramsProvider = new ContractParamsProvider({
dataServiceId: "redstone-primary-prod",
uniqueSignersCount: 2,
dataPackagesIds: ["LBTC", "BTC", "ETH"],
uniqueSignersCount: 3,
dataPackagesIds: ["ETH", "BTC"],
authorizedSigners: getSignersForDataServiceId("redstone-primary-prod"),
});
const { account, network, url } = getEnvParams(["CONTRACT_NAME"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ const WRITE_TEST_TIMEOUT = 20_000;
const WAIT_TS = 5_000;
const HOUR_MS = 3_600_000;
const DATA_SERVICE_ID = "redstone-primary-prod";
const FEED_ETH = "ETH";
const FEED_BTC = "BTC";
const FEED_LBTC = "LBTC";
const DATA_PACKAGES_IDS = [FEED_ETH, FEED_BTC, FEED_LBTC];
const FEED_ETH = "ETH";
const DATA_PACKAGES_IDS = [FEED_ETH, FEED_BTC];
const SIGNERS_COUNT = 3;

jest.setTimeout(TEST_FILE_TIMEOUT);

Expand Down Expand Up @@ -96,7 +96,7 @@ describe("MovementPricesContractAdapter", () => {
contractParamsProviderMultiple = new ContractParamsProvider({
dataServiceId: DATA_SERVICE_ID,
dataPackagesIds: DATA_PACKAGES_IDS,
uniqueSignersCount: 2,
uniqueSignersCount: SIGNERS_COUNT,
authorizedSigners: getSignersForDataServiceId(DATA_SERVICE_ID),
});
});
Expand All @@ -119,7 +119,7 @@ describe("MovementPricesContractAdapter", () => {
contractParamsProviderMultiple = new ContractParamsProvider({
dataServiceId: DATA_SERVICE_ID,
dataPackagesIds: DATA_PACKAGES_IDS,
uniqueSignersCount: 2,
uniqueSignersCount: SIGNERS_COUNT,
authorizedSigners: getSignersForDataServiceId(DATA_SERVICE_ID),
});
});
Expand All @@ -135,7 +135,7 @@ describe("MovementPricesContractAdapter", () => {
});

// this would fail if ETH flipped BTC
expect(result[1] < result[2]).toBeTruthy();
expect(result[0] < result[1]).toBeTruthy();
});
});

Expand Down

0 comments on commit cb3dbd7

Please sign in to comment.