Skip to content

Commit

Permalink
Merge pull request #391 from Uniswap/cb-tweak
Browse files Browse the repository at this point in the history
chore: exponential backoff factor 1.5 -> 1.2
  • Loading branch information
ConjunctiveNormalForm authored Dec 2, 2024
2 parents 57bf532 + b4d293c commit 1c5c654
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/cron/fade-rate-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type FillerFades = Record<string, number>;
export type FillerTimestamps = Map<string, Omit<TimestampRepoRow, 'hash'>>;

export const BASE_BLOCK_SECS = 60 * 15; // 15 minutes
export const NUM_FADES_MULTIPLIER = 1.5;
export const NUM_FADES_MULTIPLIER = 1.2;

const log = Logger.createLogger({
name: 'FadeRate',
Expand Down Expand Up @@ -214,19 +214,19 @@ export function getFillersNewFades(
/*
calculate the block until timestamp with exponential backoff
if a filler faded multiple times in between the last post timestamp and now,
we apply a 1.5 multiplier for each fade
we apply a 1.2 multiplier for each fade
examples:
- 1 fade, 0 consecutive blocks: 15 minutes
- 1 fade, 1 consecutive blocks: (1.5 ^ 0) * 15 * 2^1 = 30 minutes
- 1 fade, 2 consecutive blocks: (1.5 ^ 0) * 15 * 2^2 = 60 minutes
- 1 fade, 3 consecutive blocks: (1.5 ^ 0) * 15 * 2^3 = 120 minutes
- 2 fades, 0 consecutive blocks: (1.5 ^ 1) * 15 * 2^0 = 22 minutes
- 2 fades 1 consecutive blocks: (1.5 ^ 1) * 15 * 2^1 = 45 minutes
- 2 fades 2 consecutive blocks: (1.5 ^ 1) * 15 * 2^2 = 90 minute
- 3 fades 0 consecutive blocks: (1.5 ^ 2) * 15 * 2^0 = 33 minutes
- 3 fades 1 consecutive blocks: (1.5 ^ 2) * 15 * 2^1 = 67 minutes
- 3 fades 2 consecutive blocks: (1.5 ^ 2) * 15 * 2^2 = 135 minutes
- 1 fade, 1 consecutive blocks: (1.2 ^ 0) * 15 * 2^1 = 30 minutes
- 1 fade, 2 consecutive blocks: (1.2 ^ 0) * 15 * 2^2 = 60 minutes
- 1 fade, 3 consecutive blocks: (1.2 ^ 0) * 15 * 2^3 = 120 minutes
- 2 fades, 0 consecutive blocks: (1.2 ^ 1) * 15 * 2^0 = 18 minutes
- 2 fades 1 consecutive blocks: (1.2 ^ 1) * 15 * 2^1 = 36 minutes
- 2 fades 2 consecutive blocks: (1.2 ^ 1) * 15 * 2^2 = 72 minute
- 3 fades 0 consecutive blocks: (1.2 ^ 2) * 15 * 2^0 = 21 minutes
- 3 fades 1 consecutive blocks: (1.2 ^ 2) * 15 * 2^1 = 43 minutes
- 3 fades 2 consecutive blocks: (1.2 ^ 2) * 15 * 2^2 = 86 minutes
*/
export function calculateBlockUntilTimestamp(
newPostTimestamp: number,
Expand Down

0 comments on commit 1c5c654

Please sign in to comment.