Skip to content

Commit

Permalink
fix: Pinned subgraphs are now whitelisted
Browse files Browse the repository at this point in the history
It makes sense for pinned subgraphs to be treated as part of the
whitelist since we will 100% be allocating on them. The only question is
whether it is a 0.1 GRT or a larger GRT allocation.
  • Loading branch information
anirudh2 committed Apr 24, 2023
1 parent ae966fe commit ddacc55
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/domain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ julia> config = Dict(
"whitelist" => String["Qmb", "Qmc"],
"blacklist" => String[],
"frozenlist" => String[],
"pinnedlist" => String[],
"min_signal" => 0.0
)
julia> fs = AllocationOpt.allocatablesubgraphs(s, config)
Expand All @@ -416,8 +417,8 @@ FlexTable with 2 columns and 2 rows:
"""
function allocatablesubgraphs(s::FlexTable, config::AbstractDict)
# If no whitelist, whitelist is all subgraphs
whitelist =
isempty(config["whitelist"]) ? ipfshash(Val(:subgraph), s) : config["whitelist"]
w = config["whitelist"] config["pinnedlist"]
whitelist = isempty(w) ? ipfshash(Val(:subgraph), s) : w

# For filtering, blacklist contains both the blacklist and frozenlist,
# since frozen allocations aren't considered during optimisation.
Expand Down
16 changes: 16 additions & 0 deletions test/domain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"whitelist" => String[],
"blacklist" => String[],
"frozenlist" => String["Qma", "Qmb"],
"pinnedlist" => String[],
"min_signal" => 0.0,
)
fs = AllocationOpt.allocatablesubgraphs(s, config)
Expand All @@ -119,6 +120,7 @@
"whitelist" => String[],
"blacklist" => String["Qma"],
"frozenlist" => String["Qmb"],
"pinnedlist" => String[],
"min_signal" => 0.0,
)
fs = AllocationOpt.allocatablesubgraphs(s, config)
Expand All @@ -128,6 +130,7 @@
"whitelist" => String["Qmb", "Qmc"],
"blacklist" => String[],
"frozenlist" => String[],
"pinnedlist" => String[],
"min_signal" => 0.0,
)
fs = AllocationOpt.allocatablesubgraphs(s, config)
Expand All @@ -137,6 +140,7 @@
"whitelist" => String["Qmb", "Qmc"],
"blacklist" => String["Qma"],
"frozenlist" => String[],
"pinnedlist" => String[],
"min_signal" => 0.0,
)
fs = AllocationOpt.allocatablesubgraphs(s, config)
Expand All @@ -146,6 +150,7 @@
"whitelist" => String[],
"blacklist" => String[],
"frozenlist" => String[],
"pinnedlist" => String[],
"min_signal" => 0.0,
)
fs = AllocationOpt.allocatablesubgraphs(s, config)
Expand All @@ -155,10 +160,21 @@
"whitelist" => String[],
"blacklist" => String[],
"frozenlist" => String[],
"pinnedlist" => String[],
"min_signal" => 7.0,
)
fs = AllocationOpt.allocatablesubgraphs(s, config)
@test AllocationOpt.ipfshash(Val(:subgraph), fs) == ["Qmb", "Qmc"]

config = Dict(
"whitelist" => String[],
"blacklist" => String[],
"frozenlist" => String[],
"pinnedlist" => String["Qmb", "Qmc"],
"min_signal" => 0.0,
)
fs = AllocationOpt.allocatablesubgraphs(s, config)
@test AllocationOpt.ipfshash(Val(:subgraph), fs) == ["Qmb", "Qmc"]
end

@testset "newtokenissuance" begin
Expand Down

0 comments on commit ddacc55

Please sign in to comment.