diff --git a/spec/arns_spec.lua b/spec/arns_spec.lua index b6b5a39e..ecc62556 100644 --- a/spec/arns_spec.lua +++ b/spec/arns_spec.lua @@ -169,7 +169,7 @@ describe("arns", function() _G.GatewayRegistry[testAddress] = testGateway _G.GatewayRegistry[testAddress].weights = { tenureWeight = constants.ARNS_DISCOUNT_TENURE_WEIGHT_ELIGIBILITY_THRESHOLD, - gatewayRewardRatioWeight = constants.ARNS_DISCOUNT_GATEWAY_PERFORMANCE_RATIO_ELIGIBILITY_THRESHOLD, + gatewayPerformanceRatio = constants.ARNS_DISCOUNT_GATEWAY_PERFORMANCE_RATIO_ELIGIBILITY_THRESHOLD, } local result = gar.isEligibleForArNSDiscount(testAddress) assert.is_true(result) @@ -450,7 +450,7 @@ describe("arns", function() _G.GatewayRegistry[testAddress] = testGateway _G.GatewayRegistry[testAddress].weights = { tenureWeight = constants.ARNS_DISCOUNT_TENURE_WEIGHT_ELIGIBILITY_THRESHOLD, - gatewayRewardRatioWeight = constants.ARNS_DISCOUNT_GATEWAY_PERFORMANCE_RATIO_ELIGIBILITY_THRESHOLD, + gatewayPerformanceRatio = constants.ARNS_DISCOUNT_GATEWAY_PERFORMANCE_RATIO_ELIGIBILITY_THRESHOLD, } assert.is_true(gar.isEligibleForArNSDiscount(testAddress)) @@ -632,7 +632,7 @@ describe("arns", function() _G.GatewayRegistry[testAddress] = testGateway _G.GatewayRegistry[testAddress].weights = { tenureWeight = constants.ARNS_DISCOUNT_TENURE_WEIGHT_ELIGIBILITY_THRESHOLD, - gatewayRewardRatioWeight = constants.ARNS_DISCOUNT_GATEWAY_PERFORMANCE_RATIO_ELIGIBILITY_THRESHOLD, + gatewayPerformanceRatio = constants.ARNS_DISCOUNT_GATEWAY_PERFORMANCE_RATIO_ELIGIBILITY_THRESHOLD, } local result = gar.isEligibleForArNSDiscount(testAddress) assert.is_true(result) @@ -900,7 +900,7 @@ describe("arns", function() _G.GatewayRegistry[stubRandomAddress] = testGateway _G.GatewayRegistry[stubRandomAddress].weights = { tenureWeight = constants.ARNS_DISCOUNT_TENURE_WEIGHT_ELIGIBILITY_THRESHOLD, - gatewayRewardRatioWeight = constants.ARNS_DISCOUNT_GATEWAY_PERFORMANCE_RATIO_ELIGIBILITY_THRESHOLD, + gatewayPerformanceRatio = constants.ARNS_DISCOUNT_GATEWAY_PERFORMANCE_RATIO_ELIGIBILITY_THRESHOLD, } local result = gar.isEligibleForArNSDiscount(stubRandomAddress) assert.is_true(result) @@ -925,7 +925,7 @@ describe("arns", function() _G.GatewayRegistry[stubRandomAddress] = testGateway _G.GatewayRegistry[stubRandomAddress].weights = { tenureWeight = 0.1, - gatewayRewardRatioWeight = 0.1, + gatewayPerformanceRatio = 0.1, } local result = gar.isEligibleForArNSDiscount(stubRandomAddress) assert.is_false(result) @@ -1407,7 +1407,7 @@ describe("arns", function() _G.GatewayRegistry[stubRandomAddress] = testGateway _G.GatewayRegistry[stubRandomAddress].weights = { tenureWeight = constants.ARNS_DISCOUNT_TENURE_WEIGHT_ELIGIBILITY_THRESHOLD, - gatewayRewardRatioWeight = constants.ARNS_DISCOUNT_GATEWAY_PERFORMANCE_RATIO_ELIGIBILITY_THRESHOLD, + gatewayPerformanceRatio = constants.ARNS_DISCOUNT_GATEWAY_PERFORMANCE_RATIO_ELIGIBILITY_THRESHOLD, } _G.NameRegistry.records["upgrade-name"] = { endTimestamp = 1000000, diff --git a/spec/epochs_spec.lua b/spec/epochs_spec.lua index a1a1246f..570029d7 100644 --- a/spec/epochs_spec.lua +++ b/spec/epochs_spec.lua @@ -74,8 +74,8 @@ describe("epochs", function() normalizedCompositeWeight = 1, stakeWeight = 1, tenureWeight = 1, - gatewayRewardRatioWeight = 1, - observerRewardRatioWeight = 1, + gatewayPerformanceRatio = 1, + observerPerformanceRatio = 1, compositeWeight = 1, }, } @@ -90,8 +90,8 @@ describe("epochs", function() normalizedCompositeWeight = 1, stakeWeight = 1, tenureWeight = 1, - gatewayRewardRatioWeight = 1, - observerRewardRatioWeight = 1, + gatewayPerformanceRatio = 1, + observerPerformanceRatio = 1, compositeWeight = 1, stake = gar.getSettings().operators.minStake, startTimestamp = startTimestamp, @@ -126,8 +126,8 @@ describe("epochs", function() normalizedCompositeWeight = 1, stakeWeight = 1, tenureWeight = 1, - gatewayRewardRatioWeight = 1, - observerRewardRatioWeight = 1, + gatewayPerformanceRatio = 1, + observerPerformanceRatio = 1, compositeWeight = 1, }, } @@ -169,8 +169,8 @@ describe("epochs", function() normalizedCompositeWeight = 1, stakeWeight = 1, tenureWeight = 1, - gatewayRewardRatioWeight = 1, - observerRewardRatioWeight = 1, + gatewayPerformanceRatio = 1, + observerPerformanceRatio = 1, compositeWeight = 1, }, } @@ -323,8 +323,8 @@ describe("epochs", function() normalizedCompositeWeight = 1, stakeWeight = 1, tenureWeight = 1, - gatewayRewardRatioWeight = 1, - observerRewardRatioWeight = 1, + gatewayPerformanceRatio = 1, + observerPerformanceRatio = 1, compositeWeight = 1, }, }, @@ -350,8 +350,8 @@ describe("epochs", function() normalizedCompositeWeight = 1, stakeWeight = 1, tenureWeight = 1, - gatewayRewardRatioWeight = 1, - observerRewardRatioWeight = 1, + gatewayPerformanceRatio = 1, + observerPerformanceRatio = 1, compositeWeight = 1, }, }, @@ -377,8 +377,8 @@ describe("epochs", function() normalizedCompositeWeight = 1, stakeWeight = 1, tenureWeight = 1, - gatewayRewardRatioWeight = 1, - observerRewardRatioWeight = 1, + gatewayPerformanceRatio = 1, + observerPerformanceRatio = 1, compositeWeight = 1, }, }, @@ -405,8 +405,8 @@ describe("epochs", function() normalizedCompositeWeight = 1, stakeWeight = 1, tenureWeight = 1, - gatewayRewardRatioWeight = 1, - observerRewardRatioWeight = 1, + gatewayPerformanceRatio = 1, + observerPerformanceRatio = 1, compositeWeight = 1, }, }, @@ -482,8 +482,8 @@ describe("epochs", function() weights = { stakeWeight = 0, tenureWeight = 0, - gatewayRewardRatioWeight = 0, - observerRewardRatioWeight = 0, + gatewayPerformanceRatio = 0, + observerPerformanceRatio = 0, compositeWeight = 0, normalizedCompositeWeight = 0, }, @@ -510,8 +510,8 @@ describe("epochs", function() weights = { stakeWeight = 0, tenureWeight = 0, - gatewayRewardRatioWeight = 0, - observerRewardRatioWeight = 0, + gatewayPerformanceRatio = 0, + observerPerformanceRatio = 0, compositeWeight = 0, normalizedCompositeWeight = 0, }, @@ -565,8 +565,8 @@ describe("epochs", function() assert.are.same({ stakeWeight = 1, tenureWeight = 4, - gatewayRewardRatioWeight = 1, - observerRewardRatioWeight = 1, + gatewayPerformanceRatio = 1, + observerPerformanceRatio = 1, compositeWeight = 4, normalizedCompositeWeight = 1, }, _G.GatewayRegistry["test-this-is-valid-arweave-wallet-address-1"].weights) @@ -574,8 +574,8 @@ describe("epochs", function() assert.are.same({ stakeWeight = 0, tenureWeight = 0, - gatewayRewardRatioWeight = 0, - observerRewardRatioWeight = 0, + gatewayPerformanceRatio = 0, + observerPerformanceRatio = 0, compositeWeight = 0, normalizedCompositeWeight = 0, }, _G.GatewayRegistry["test-this-is-valid-arweave-wallet-address-2"].weights) diff --git a/spec/gar_spec.lua b/spec/gar_spec.lua index afc378e0..6e09015a 100644 --- a/spec/gar_spec.lua +++ b/spec/gar_spec.lua @@ -53,8 +53,8 @@ local testGateway = { weights = { stakeWeight = 0, tenureWeight = 0, - gatewayRewardRatioWeight = 0, - observerRewardRatioWeight = 0, + gatewayPerformanceRatio = 0, + observerPerformanceRatio = 0, compositeWeight = 0, normalizedCompositeWeight = 0, }, @@ -1933,8 +1933,8 @@ describe("gar", function() startTimestamp = 0, stakeWeight = expectedStakeWeight, tenureWeight = expectedTenureWeight, - gatewayRewardRatioWeight = expectedGatewayRatioWeight, - observerRewardRatioWeight = expectedObserverRatioWeight, + gatewayPerformanceRatio = expectedGatewayRatioWeight, + observerPerformanceRatio = expectedObserverRatioWeight, compositeWeight = expectedCompositeWeight, normalizedCompositeWeight = 1, -- there is only one gateway }, @@ -2328,6 +2328,10 @@ describe("gar", function() local gateway2Copy = utils.deepCopy(gateway2) gateway2Copy.delegates = nil gateway2Copy.vaults = nil + -- TODO: add gatewayRewardRatioWeight and observerRewardRatioWeight as gatewayPerformanceRatio and observerPerformanceRatio for backwards compatibility + gateway2Copy.weights.gatewayRewardRatioWeight = gateway2Copy.weights.gatewayPerformanceRatio or 0 + gateway2Copy.weights.observerRewardRatioWeight = gateway2Copy.weights.observerPerformanceRatio or 0 + -- END TODO assert.are.same({ limit = 1, sortBy = "startTimestamp", @@ -2344,6 +2348,10 @@ describe("gar", function() local gateway1Copy = utils.deepCopy(gateway1) gateway1Copy.delegates = nil gateway1Copy.vaults = nil + -- TODO: add gatewayRewardRatioWeight and observerRewardRatioWeight as gatewayPerformanceRatio and observerPerformanceRatio for backwards compatibility + gateway1Copy.weights.gatewayRewardRatioWeight = gateway1Copy.weights.gatewayPerformanceRatio or 0 + gateway1Copy.weights.observerRewardRatioWeight = gateway1Copy.weights.observerPerformanceRatio or 0 + -- END TODO assert.are.same({ limit = 1, sortBy = "startTimestamp", @@ -2374,9 +2382,9 @@ describe("gar", function() _G.GatewayRegistry[stubRandomAddress] = testGateway _G.GatewayRegistry[stubRandomAddress].weights = { tenureWeight = 0.5, - gatewayRewardRatioWeight = 0.85, + gatewayPerformanceRatio = 0.85, stakeWeight = 0, - observerRewardRatioWeight = 0, + observerPerformanceRatio = 0, compositeWeight = 0, normalizedCompositeWeight = 0, } @@ -2388,9 +2396,9 @@ describe("gar", function() _G.GatewayRegistry[stubRandomAddress] = testGateway _G.GatewayRegistry[stubRandomAddress].weights = { tenureWeight = 1, - gatewayRewardRatioWeight = 0.84, + gatewayPerformanceRatio = 0.84, stakeWeight = 0, - observerRewardRatioWeight = 0, + observerPerformanceRatio = 0, compositeWeight = 0, normalizedCompositeWeight = 0, } @@ -2402,9 +2410,9 @@ describe("gar", function() _G.GatewayRegistry[stubRandomAddress] = testGateway _G.GatewayRegistry[stubRandomAddress].weights = { tenureWeight = 1, - gatewayRewardRatioWeight = 0.85, + gatewayPerformanceRatio = 0.85, stakeWeight = 0, - observerRewardRatioWeight = 0, + observerPerformanceRatio = 0, compositeWeight = 0, normalizedCompositeWeight = 0, } diff --git a/src/epochs.lua b/src/epochs.lua index c8e6b636..b3494448 100644 --- a/src/epochs.lua +++ b/src/epochs.lua @@ -40,8 +40,8 @@ local epochs = {} --- @field observerAddress string The observer address --- @field stakeWeight number The stake weight --- @field tenureWeight number The tenure weight ---- @field gatewayRewardRatioWeight number The gateway reward ratio weight ---- @field observerRewardRatioWeight number The observer reward ratio weight +--- @field gatewayPerformanceRatio number The gateway reward ratio weight +--- @field observerPerformanceRatio number The observer reward ratio weight --- @field compositeWeight number The composite weight --- @field normalizedCompositeWeight number The normalized composite weight @@ -136,8 +136,8 @@ function epochs.getPrescribedObserversWithWeightsForEpoch(epochIndex) normalizedCompositeWeight = gateway.weights.normalizedCompositeWeight, stakeWeight = gateway.weights.stakeWeight, tenureWeight = gateway.weights.tenureWeight, - gatewayRewardRatioWeight = gateway.weights.gatewayRewardRatioWeight, - observerRewardRatioWeight = gateway.weights.observerRewardRatioWeight, + gatewayPerformanceRatio = gateway.weights.gatewayPerformanceRatio, + observerPerformanceRatio = gateway.weights.observerPerformanceRatio, compositeWeight = gateway.weights.compositeWeight, stake = gateway.operatorStake, startTimestamp = gateway.startTimestamp, diff --git a/src/gar.lua b/src/gar.lua index 4aff5eaf..15605850 100644 --- a/src/gar.lua +++ b/src/gar.lua @@ -50,8 +50,8 @@ local gar = {} --- @class GatewayWeights --- @field stakeWeight number --- @field tenureWeight number ---- @field gatewayRewardRatioWeight number ---- @field observerRewardRatioWeight number +--- @field gatewayPerformanceRatio number +--- @field observerPerformanceRatio number --- @field compositeWeight number --- @field normalizedCompositeWeight number @@ -184,8 +184,8 @@ function gar.joinNetwork(from, stake, settings, services, observerAddress, timeS weights = { stakeWeight = 0, tenureWeight = 0, - gatewayRewardRatioWeight = 0, - observerRewardRatioWeight = 0, + gatewayPerformanceRatio = 0, + observerPerformanceRatio = 0, compositeWeight = 0, normalizedCompositeWeight = 0, }, @@ -738,15 +738,15 @@ function gar.getGatewayWeightsAtTimestamp(gatewayAddresses, timestamp) local totalEpochsGatewayPassed = gateway.stats.passedEpochCount or 0 local totalEpochsParticipatedIn = gateway.stats.totalEpochCount or 0 - local gatewayRewardRatioWeight = (1 + totalEpochsGatewayPassed) / (1 + totalEpochsParticipatedIn) + local gatewayPerformanceRatio = (1 + totalEpochsGatewayPassed) / (1 + totalEpochsParticipatedIn) local totalEpochsPrescribed = gateway.stats.prescribedEpochCount or 0 local totalEpochsSubmitted = gateway.stats.observedEpochCount or 0 - local observerRewardRatioWeight = (1 + totalEpochsSubmitted) / (1 + totalEpochsPrescribed) + local observerPerformanceRatio = (1 + totalEpochsSubmitted) / (1 + totalEpochsPrescribed) local compositeWeight = stakeWeightRatio * gatewayTenureWeight - * gatewayRewardRatioWeight - * observerRewardRatioWeight + * gatewayPerformanceRatio + * observerPerformanceRatio table.insert(weightedObservers, { gatewayAddress = gatewayAddress, @@ -755,8 +755,8 @@ function gar.getGatewayWeightsAtTimestamp(gatewayAddresses, timestamp) startTimestamp = gateway.startTimestamp, stakeWeight = stakeWeightRatio, tenureWeight = gatewayTenureWeight, - gatewayRewardRatioWeight = gatewayRewardRatioWeight, - observerRewardRatioWeight = observerRewardRatioWeight, + gatewayPerformanceRatio = gatewayPerformanceRatio, + observerPerformanceRatio = observerPerformanceRatio, compositeWeight = compositeWeight, normalizedCompositeWeight = nil, -- set later once we have the total composite weight }) @@ -918,16 +918,16 @@ function gar.updateGatewayWeights(weightedGateway) assert(gateway, "Gateway not found") assert(weightedGateway.stakeWeight, "stakeWeight is required") assert(weightedGateway.tenureWeight, "tenureWeight is required") - assert(weightedGateway.gatewayRewardRatioWeight, "gatewayRewardRatioWeight is required") - assert(weightedGateway.observerRewardRatioWeight, "observerRewardRatioWeight is required") + assert(weightedGateway.gatewayPerformanceRatio, "gatewayPerformanceRatio is required") + assert(weightedGateway.observerPerformanceRatio, "observerPerformanceRatio is required") assert(weightedGateway.compositeWeight, "compositeWeight is required") assert(weightedGateway.normalizedCompositeWeight, "normalizedCompositeWeight is required") gateway.weights = { stakeWeight = weightedGateway.stakeWeight, tenureWeight = weightedGateway.tenureWeight, - gatewayRewardRatioWeight = weightedGateway.gatewayRewardRatioWeight, - observerRewardRatioWeight = weightedGateway.observerRewardRatioWeight, + gatewayPerformanceRatio = weightedGateway.gatewayPerformanceRatio, + observerPerformanceRatio = weightedGateway.observerPerformanceRatio, compositeWeight = weightedGateway.compositeWeight, normalizedCompositeWeight = weightedGateway.normalizedCompositeWeight, } @@ -1122,13 +1122,17 @@ function gar.getPaginatedGateways(cursor, limit, sortBy, sortOrder) local gateways = gar.getGateways() local gatewaysArray = {} local cursorField = "gatewayAddress" -- the cursor will be the gateway address - for address, record in pairs(gateways) do + for address, gateway in pairs(gateways) do --- @diagnostic disable-next-line: inject-field - record.gatewayAddress = address + gateway.gatewayAddress = address + -- TODO: inject these for backwards compatibility - after ar-io-sdk update, remove these + gateway.weights.gatewayRewardRatioWeight = gateway.weights.gatewayPerformanceRatio or 0 + gateway.weights.observerRewardRatioWeight = gateway.weights.observerPerformanceRatio or 0 + -- END TODO -- remove delegates and vaults to avoid sending unbounded arrays, they can be fetched via getPaginatedDelegates and getPaginatedVaults - record.delegates = nil - record.vaults = nil - table.insert(gatewaysArray, record) + gateway.delegates = nil + gateway.vaults = nil + table.insert(gatewaysArray, gateway) end return utils.paginateTableWithCursor(gatewaysArray, cursor, cursorField, limit, sortBy, sortOrder) @@ -1341,7 +1345,7 @@ function gar.isEligibleForArNSDiscount(from) end local tenureWeight = gateway.weights.tenureWeight or 0 - local gatewayPerformanceRatio = gateway.weights.gatewayRewardRatioWeight or 0 + local gatewayPerformanceRatio = gateway.weights.gatewayPerformanceRatio or 0 return tenureWeight >= constants.ARNS_DISCOUNT_TENURE_WEIGHT_ELIGIBILITY_THRESHOLD and gatewayPerformanceRatio >= constants.ARNS_DISCOUNT_GATEWAY_PERFORMANCE_RATIO_ELIGIBILITY_THRESHOLD @@ -1493,13 +1497,13 @@ function getStakingProfile(address) function(acc, gatewayAddress, gateway) local totalEpochsGatewayPassed = gateway.stats.passedEpochCount or 0 local totalEpochsParticipatedIn = gateway.stats.totalEpochCount or 0 - local gatewayRewardRatioWeight = (1 + totalEpochsGatewayPassed) / (1 + totalEpochsParticipatedIn) + local gatewayPerformanceRatio = (1 + totalEpochsGatewayPassed) / (1 + totalEpochsParticipatedIn) local delegate = utils.deepCopy(gateway.delegates[address]) delegate.excessStake = math.max(0, delegate.delegatedStake - gateway.settings.minDelegatedStake) delegate.gatewayAddress = gatewayAddress table.insert(acc, { totalDelegatedStake = gateway.totalDelegatedStake, -- for comparing gw total stake - gatewayRewardRatioWeight = gatewayRewardRatioWeight, -- for comparing gw performance + gatewayPerformanceRatio = gatewayPerformanceRatio, -- for comparing gw performance delegate = delegate, startTimestamp = gateway.startTimestamp, -- for comparing gw tenure }) @@ -1514,7 +1518,7 @@ function getStakingProfile(address) }, { order = "asc", - field = "gatewayRewardRatioWeight", + field = "gatewayPerformanceRatio", }, { order = "desc", @@ -1608,7 +1612,7 @@ function planMinimumStakesDrawdown(fundingPlan, stakingProfile) stakingProfile = utils.sortTableByFields(stakingProfile, { { order = "asc", - field = "gatewayRewardRatioWeight", + field = "gatewayPerformanceRatio", }, { order = "desc", diff --git a/src/main.lua b/src/main.lua index eacdfe94..3a927fd1 100644 --- a/src/main.lua +++ b/src/main.lua @@ -1928,6 +1928,12 @@ end) addEventingHandler(ActionMap.Gateway, Handlers.utils.hasMatchingTag("Action", ActionMap.Gateway), function(msg) local gateway = gar.getCompactGateway(msg.Tags.Address or msg.From) + -- TODO: inject these for backwards compatibility - after ar-io-sdk update, remove these + if gateway then + gateway.weights.gatewayRewardRatioWeight = gateway.weights.gatewayPerformanceRatio or 0 + gateway.weights.observerRewardRatioWeight = gateway.weights.observerPerformanceRatio or 0 + end + -- END TODO Send(msg, { Target = msg.From, Action = "Gateway-Notice", @@ -2666,20 +2672,27 @@ addEventingHandler("allPaginatedGatewayVaults", utils.hasMatchingTag("Action", " end) -- TODO: handler for posting epoch distribution notices (make sure to remove this once previous epochs are distributed) -addEventingHandler("postEpochDistributionNotice", utils.hasMatchingTag("Action", "Post-Epochs"), function(msg) - -- iterate over epochs and post epoch-distribution-notice for each epoch - for epochIndex, _ in pairs(epochs.getEpochs()) do - local epoch = epochs.getEpoch(epochIndex) - if epoch.distributions.distributedTimestamp then - epoch.prescribedObservers = epochs.getPrescribedObserversWithWeightsForEpoch(epochIndex) - Send(msg, { - Target = msg.From, - Action = "Epoch-Distribution-Notice", - ["Epoch-Index"] = tostring(epochIndex), - Data = json.encode(epoch), - }) +UpdateGateways = false +addEventingHandler("updateGatewayAttributes", utils.hasMatchingTag("Action", "Update-Gateway-Attributes"), function() + if UpdateGateways then + return + end + --- iterate over all gateways and update their attributes + for _, gateway in pairs(gar.getGatewaysUnsafe()) do + if gateway.weights.gatewayRewardRatioWeight then + -- set the gatewayRewardShareRatio to gatewayPerformanceRatio + gateway.weights.gatewayPerformanceRatio = gateway.weights.gatewayRewardRatioWeight + -- set the gatewayRewardRatioWeight to observerRewardRatioWeight to nil + gateway.weights.gatewayRewardRatioWeight = nil + end + if gateway.weights.observerRewardRatioWeight then + -- set the observerRewardShareRatio to observerPerformanceRatio + gateway.weights.observerPerformanceRatio = gateway.weights.observerRewardRatioWeight + -- set the observerRewardRatioWeight to nil + gateway.weights.observerRewardRatioWeight = nil end end + UpdateGateways = true end) return process diff --git a/src/tick.lua b/src/tick.lua index 5b2c4a7c..b450c3dd 100644 --- a/src/tick.lua +++ b/src/tick.lua @@ -4,7 +4,7 @@ local demand = require("demand") local gar = require("gar") --- @class TickResult ---- @field maybeDistributedEpoch Epoch | nil The distributed epoch +--- @field maybeDistributedEpoch DistributedEpoch | nil The distributed epoch --- @field maybeNewEpoch Epoch | nil The new epoch --- @field maybeDemandFactor number | nil The demand factor --- @field pruneGatewaysResult PruneGatewaysResult The prune gateways result diff --git a/tests/arns.test.mjs b/tests/arns.test.mjs index 950b4804..212a0dd4 100644 --- a/tests/arns.test.mjs +++ b/tests/arns.test.mjs @@ -1631,7 +1631,7 @@ describe('ArNS', async () => { 'Gateway should have a tenure weight greater than or equal to 1', ); assert( - gatewayData.weights.gatewayRewardRatioWeight >= 1, + gatewayData.weights.gatewayPerformanceRatio >= 1, 'Gateway should have a gateway reward ratio weight greater than or equal to 1', ); diff --git a/tests/epochs.test.mjs b/tests/epochs.test.mjs index 3f1d2ca0..43c5dcc2 100644 --- a/tests/epochs.test.mjs +++ b/tests/epochs.test.mjs @@ -65,8 +65,8 @@ describe('epochs', () => { observerAddress: STUB_ADDRESS, gatewayAddress: STUB_OPERATOR_ADDRESS, stakeWeight: 1, - gatewayRewardRatioWeight: 1, - observerRewardRatioWeight: 1, + gatewayPerformanceRatio: 1, + observerPerformanceRatio: 1, compositeWeight: 4, normalizedCompositeWeight: 1, tenureWeight: 4, @@ -109,10 +109,10 @@ describe('epochs', () => { { compositeWeight: 4, gatewayAddress: STUB_OPERATOR_ADDRESS, - gatewayRewardRatioWeight: 1, + gatewayPerformanceRatio: 1, normalizedCompositeWeight: 1, observerAddress: STUB_ADDRESS, - observerRewardRatioWeight: 1, + observerPerformanceRatio: 1, stakeWeight: 1, stake: INITIAL_OPERATOR_STAKE, startTimestamp: STUB_TIMESTAMP, diff --git a/tests/gar.test.mjs b/tests/gar.test.mjs index 7259b4e1..8bda68ca 100644 --- a/tests/gar.test.mjs +++ b/tests/gar.test.mjs @@ -115,8 +115,12 @@ describe('GatewayRegistry', async () => { weights: { stakeWeight: 0, tenureWeight: 0, + gatewayPerformanceRatio: 0, + observerPerformanceRatio: 0, + // TODO: add gatewayRewardRatioWeight and observerRewardRatioWeight as gatewayPerformanceRatio and observerPerformanceRatio for backwards compatibility gatewayRewardRatioWeight: 0, observerRewardRatioWeight: 0, + // END TODO compositeWeight: 0, normalizedCompositeWeight: 0, }, @@ -188,8 +192,12 @@ describe('GatewayRegistry', async () => { weights: { stakeWeight: 0, tenureWeight: 0, + gatewayPerformanceRatio: 0, + observerPerformanceRatio: 0, + // TODO: add gatewayRewardRatioWeight and observerRewardRatioWeight as gatewayPerformanceRatio and observerPerformanceRatio for backwards compatibility gatewayRewardRatioWeight: 0, observerRewardRatioWeight: 0, + // END TODO compositeWeight: 0, normalizedCompositeWeight: 0, }, diff --git a/tests/tick.test.mjs b/tests/tick.test.mjs index 964380e7..b2086881 100644 --- a/tests/tick.test.mjs +++ b/tests/tick.test.mjs @@ -427,8 +427,8 @@ describe('Tick', async () => { observerAddress: STUB_ADDRESS, gatewayAddress: STUB_ADDRESS, stakeWeight: 3, - gatewayRewardRatioWeight: 1, - observerRewardRatioWeight: 1, + gatewayPerformanceRatio: 1, + observerPerformanceRatio: 1, compositeWeight: 12, normalizedCompositeWeight: 1, tenureWeight: 4, @@ -577,9 +577,13 @@ describe('Tick', async () => { }, weights: { compositeWeight: 22, - gatewayRewardRatioWeight: 1, + gatewayPerformanceRatio: 1, normalizedCompositeWeight: 1, + observerPerformanceRatio: 1, + // TODO: add gatewayRewardRatioWeight and observerRewardRatioWeight as gatewayPerformanceRatio and observerPerformanceRatio for backwards compatibility + gatewayRewardRatioWeight: 1, observerRewardRatioWeight: 1, + // END TODO stakeWeight: 5.5, tenureWeight: 4, },