From 6c13a7f04fb75c8b4f4fce92847967269607e450 Mon Sep 17 00:00:00 2001 From: Rucknium Date: Mon, 1 Apr 2024 18:33:30 +0000 Subject: [PATCH] Add spam end date to Monero-Black-Marble-Flood --- .../code/effective-ring-size-projections.R | 13 ++++++++++--- Monero-Black-Marble-Flood/code/fee-behavior.R | 2 ++ .../code/mempool-tx-confirmation.R | 2 ++ .../code/spam-assumptions.R | 19 +++++++++++++------ 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Monero-Black-Marble-Flood/code/effective-ring-size-projections.R b/Monero-Black-Marble-Flood/code/effective-ring-size-projections.R index 8f0f999..ff2b9a0 100644 --- a/Monero-Black-Marble-Flood/code/effective-ring-size-projections.R +++ b/Monero-Black-Marble-Flood/code/effective-ring-size-projections.R @@ -2,7 +2,7 @@ mean.coinbase.tx.size <- output.index[!duplicated(tx_hash) & tx_num == 1, mean(tx_size_bytes)] -num.blocks.since.spam <- output.index[block_height >= start.spam.height, uniqueN(block_height)] +num.blocks.during.spam <- output.index[block_height %between% c(start.spam.height, end.spam.height), uniqueN(block_height)] mean.size.1in.2out <- spam.results[[1]]$non.spam.fingerprint.tx[number_of_inputs == 1 & number_of_outputs == 2, mean(tx_size_bytes)] mean.size.2in.2out <- spam.results[[1]]$non.spam.fingerprint.tx[number_of_inputs == 2 & number_of_outputs == 2, mean(tx_size_bytes)] @@ -26,10 +26,17 @@ sim.spam <- lapply(c(11, 16, 25, 40, 60), FUN = function(ring.size.sim) { tx_weight_bytes - mean.size.16.ring.input * number_of_inputs + number_of_inputs * mean.size.one.ring.member * ring.size.sim] mean.non.spam.kb.per.block <- mean.coinbase.tx.size/1000 + - (sum(non.spam.fingerprint.tx.sim[block_height >= start.spam.height, tx_weight_bytes.sim])/num.blocks.since.spam)/1000 + (sum(non.spam.fingerprint.tx.sim[block_height %between% + c(start.spam.height, end.spam.height), tx_weight_bytes.sim])/num.blocks.since.spam)/1000 + mean.non.spam.output.per.block <- nrow(non.spam.fingerprint[block_height %between% + c(start.spam.height, end.spam.height), ])/num.blocks.since.spam - mean.non.spam.output.per.block <- nrow(non.spam.fingerprint[block_height >= start.spam.height, ])/num.blocks.since.spam + # Don't do this because the number of blocks after start.spam.height in + # non.spam.fingerprint.tx.sim is a little smaller than output.index: + # mean.non.spam.kb.per.block <- mean.coinbase.tx.size/1000 + + # (sum(non.spam.fingerprint.tx.sim[block_height >= start.spam.height, tx_weight_bytes.sim/uniqueN(block_height)]))/1000 + # mean.non.spam.output.per.block <- non.spam.fingerprint[block_height >= start.spam.height, .N/uniqueN(block_height)] mean.effective.ring.size <- ring.size.sim simulated.adversary.owned.outputs <- 0 diff --git a/Monero-Black-Marble-Flood/code/fee-behavior.R b/Monero-Black-Marble-Flood/code/fee-behavior.R index 52dc9df..7c9fc72 100644 --- a/Monero-Black-Marble-Flood/code/fee-behavior.R +++ b/Monero-Black-Marble-Flood/code/fee-behavior.R @@ -28,6 +28,7 @@ ggplot(all.tx.volume.fees, aes(x = block_date, colour = factor(fee_per_byte_nanoneros.cut))) + geom_line(linewidth = 1.5) + geom_vline(xintercept = start.spam.date, linetype = 2) + + geom_vline(xintercept = end.spam.date, linetype = 2) + scale_y_continuous( limits = c(0, 1), expand = c(0, 0), labels = scales::label_percent()) + scale_x_date(breaks = "3 day", expand = c(0, 0), guide = guide_axis(angle = 90)) + ggtitle("Share of transactions by fee tier (all transactions)") + @@ -71,6 +72,7 @@ ggplot(non.spam.fingerprint.tx.fees, aes(x = block_date, colour = factor(fee_per_byte_nanoneros.cut))) + geom_line(linewidth = 1.5) + geom_vline(xintercept = start.spam.date, linetype = 2) + + geom_vline(xintercept = end.spam.date, linetype = 2) + scale_y_continuous( limits = c(0, 1), expand = c(0, 0), labels = scales::label_percent()) + scale_x_date(breaks = "3 day", expand = c(0, 0), guide = guide_axis(angle = 90)) + ggtitle("Share of transactions by fee tier (suspected spam removed)") + diff --git a/Monero-Black-Marble-Flood/code/mempool-tx-confirmation.R b/Monero-Black-Marble-Flood/code/mempool-tx-confirmation.R index a7653cb..7190fd4 100644 --- a/Monero-Black-Marble-Flood/code/mempool-tx-confirmation.R +++ b/Monero-Black-Marble-Flood/code/mempool-tx-confirmation.R @@ -15,6 +15,7 @@ png("mean-delay-first-confirmation.png", width = 500, height = 600) ggplot(mempool.hourly[block_receive_time.hour >= as.POSIXct(start.spam.date - 3),], aes(x = block_receive_time.hour, y = confirmation.latency/60)) + geom_line() + geom_vline(xintercept = mempool[block_height == start.spam.height, block_receive_time_UTC[1]], linetype = 2) + + geom_vline(xintercept = mempool[block_height == end.spam.height, block_receive_time_UTC[1]], linetype = 2) + scale_y_continuous(breaks = seq(0, 600, by = 30), limits = c(0, NA), expand = c(0, 0)) + scale_x_datetime(breaks = "day", expand = c(0, 0), guide = guide_axis(angle = 90)) + ggtitle("Mean delay to first transaction confirmation") + @@ -57,6 +58,7 @@ png("max-delay-first-confirmation.png", width = 500, height = 600) ggplot(hourly.max.confirmation.latency[hour.bin >= as.POSIXct(start.spam.date - 3),], aes(x = hour.bin, y = confirmation.latency/60^2)) + geom_line() + geom_vline(xintercept = mempool[block_height == start.spam.height, block_receive_time_UTC[1]], linetype = 2) + + geom_vline(xintercept = mempool[block_height == end.spam.height, block_receive_time_UTC[1]], linetype = 2) + scale_y_continuous(breaks = seq(0, 24*5, by = 3),limits = c(0, NA), expand = c(0, 0)) + scale_x_datetime(breaks = "day", expand = c(0, 0), guide = guide_axis(angle = 90)) + ggtitle("Maximum delay to first transaction confirmation") + diff --git a/Monero-Black-Marble-Flood/code/spam-assumptions.R b/Monero-Black-Marble-Flood/code/spam-assumptions.R index 96c4dd1..baca234 100644 --- a/Monero-Black-Marble-Flood/code/spam-assumptions.R +++ b/Monero-Black-Marble-Flood/code/spam-assumptions.R @@ -3,6 +3,12 @@ start.spam.height <- 3097764 # 2024-03-04 15:21:24 start.spam.date <- as.Date("2024-03-04") + +end.spam.height <- 3114046 # 2024-03-27 06:30:37 UTC +end.spam.date <- as.Date("2024-03-27") + + + library(ggplot2) output.index[, block_date.week.day := weekdays(block_date)] @@ -41,7 +47,7 @@ for (spam.type in seq_along(spam.types)) { by = "block_date.week.day"] spam.fingerprint <- output.index[ - block_height >= start.spam.height & + block_height %between% c(start.spam.height, end.spam.height) & tx_num != 1 & eval(spam.types[[spam.type.sub]]$fingerprint.crieria), ] @@ -70,8 +76,8 @@ for (spam.type in seq_along(spam.types)) { non.spam.fingerprint <- output.index[ tx_num != 1 & ( - block_height < start.spam.height | - (block_height >= start.spam.height & + (! block_height %between% c(start.spam.height, end.spam.height)) | + (block_height %between% c(start.spam.height, end.spam.height) & ! (tx_hash %chin% spam.fingerprint.tx$tx_hash)) ), ] @@ -182,7 +188,7 @@ all.output.volume.by.day <- all.output.volume.by.day[-.N, ] png("spam-share-outputs.png", width = 600, height = 600) -ggplot(all.output.volume.by.day[block_date >= start.spam.date, ], aes(x = as.POSIXct(block_date), y = spam.share.outputs)) + +ggplot(all.output.volume.by.day[block_date %between% c(start.spam.date, end.spam.date), ], aes(x = as.POSIXct(block_date), y = spam.share.outputs)) + geom_line() + scale_y_continuous(limit = c(0, 1), expand = c(0, 0), labels = scales::label_percent()) + scale_x_datetime(date_breaks = "day", guide = guide_axis(angle = 90)) + @@ -200,8 +206,9 @@ dev.off() -mean.spam.share.outputs <- all.output.volume.by.day[block_date >= (start.spam.date + 1), mean(spam.share.outputs)] -# Skip the first day because suspected spam started in the middle of the day +mean.spam.share.outputs <- all.output.volume.by.day[block_date %between% + c(start.spam.date + 1, end.spam.date - 1), mean(spam.share.outputs)] +# Skip the first and last days because suspected spam started in the middle of the days binom.ring.size <- rbind( data.table(x = 1:16, y = dbinom(0:15, size = 11, prob = 1 - 192/233),