Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: devnet to testnet #110

Merged
merged 49 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
693575b
fix(main): comment out ticked reward distribution causing error
Oct 12, 2024
af3ffe8
chore(main): add back the table, but do not popuate it with anything
Oct 12, 2024
9b5af60
chore(main): add back length check
Oct 12, 2024
6e8f825
chore(monitor): change cron to run every hour
Oct 12, 2024
94cd898
chore(monitor): do not run at 6AM UTC
Oct 14, 2024
ed0b1cd
feat:adds new services list for each gateway. includes unit tests.
vilenarios Sep 20, 2024
8b80669
fix:used stylua to cleanup formatting
vilenarios Sep 24, 2024
a6e65da
chore(test): fix tests
Oct 8, 2024
25afa9f
feat: adds instant withdraw
vilenarios Oct 15, 2024
12d8abc
uses constants for expedited withdrawal fees
vilenarios Oct 17, 2024
01ea832
Update src/main.lua
vilenarios Oct 17, 2024
e025126
fixes check on instant tags
vilenarios Oct 17, 2024
bda1623
Fixes broken instant tag and test
vilenarios Oct 18, 2024
7afe50e
Trying to fix test...
vilenarios Oct 18, 2024
48c4c11
updates test
vilenarios Oct 18, 2024
05dc364
chore(main): small tweak to flagging instant
Oct 18, 2024
6767ff6
chore: run prettier
Oct 18, 2024
dfcef33
chore(test): increase coverage
Oct 18, 2024
ec28cfa
chore(test): more coverage
Oct 18, 2024
7f67f27
chore(montior): tweak cron for tests
Oct 18, 2024
0e7c9a1
feat(PE-6949): add delegate instant withdraws (#97)
dtfiedler Oct 18, 2024
3691d2d
chore(test): add tests for getTokenCost
Oct 18, 2024
77781df
chore(monitor): added new handler for `Instant-Delegate-Withdrawl` an…
Oct 18, 2024
c1e270f
chore(test): use different demand factors for tests
Oct 18, 2024
f8fa231
chore(test): add tests for getTokenCost (#108)
dtfiedler Oct 18, 2024
c019809
feat(events): track supply changes more closely PE-6796
Oct 18, 2024
86a2c2f
feat(events): excise unnecessary code PE-6796
Oct 18, 2024
e560ab2
feat(events): only send supply event data on change PE-6796
Oct 18, 2024
28512cc
feat(events): identify invariant slashed gws PE-6796
Oct 18, 2024
f8e41f5
test(events): test fix PE-6796
Oct 18, 2024
da286ac
feat(events): track supply changes more closely PE-6796 (#107)
arielmelendez Oct 18, 2024
ed7dfda
chore(monitor): modify monitor to check for testnet
Oct 19, 2024
25af619
chore(utils): add pagination tests
Oct 19, 2024
bf247d8
chore: remove redundant and in hasMore value
Oct 19, 2024
fa433b6
chore(utils): rename from sortedTable to sortedArray
Oct 19, 2024
44dac4f
chore(test): add fetching next page
Oct 19, 2024
17ff103
chore(test): add more test and handle nils in paginated sort
Oct 19, 2024
8551154
chore(utils): add pagination tests (#109)
dtfiedler Oct 19, 2024
b36715d
chore(utils): remove unused utils
Oct 19, 2024
9f197a9
chore(test): more coverage on tests and more efficient use of copy
Oct 19, 2024
616312e
chore(tests): add more monitor tests
Oct 19, 2024
f6c6b1c
feat(events): don't lose global tracker states on deploy PE-6796
Oct 21, 2024
01c730c
feat(events): don't lose global tracker states on deploy PE-6796 (#111)
arielmelendez Oct 21, 2024
64caf53
feat(events): send all supply data when necessary PE-6796
Oct 21, 2024
1694daa
feat(events): send all supply data when necessary PE-6796 (#112)
arielmelendez Oct 21, 2024
6418371
feat(events): send correct total supply PE-6796
Oct 22, 2024
fefa619
feat(events): send correct total supply PE-6796 (#113)
arielmelendez Oct 22, 2024
46a1fc9
feat(events): add withdraw supply to total supply PE-6796
Oct 22, 2024
b900391
feat(events): add withdraw supply to total supply PE-6796 (#114)
arielmelendez Oct 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: IO Process Status
on:
workflow_dispatch:
schedule:
- cron: '0 0-5,7-23 * * *' # Run every hour except 6AM UTC
- cron: '0 0-5,8-23 * * *' # Run every hour except 6AM UTC

jobs:
monitor:
Expand Down
4 changes: 2 additions & 2 deletions docs/save_observations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ graph TD
CheckGateway -- Doesn't Exist --> Error[Throw Error]
CheckPrescribedObserver -- Prescribed --> CheckEpoch{Check Epoch Object}
CheckPrescribedObserver -- Not Prescribed --> Error
CheckEpoch -- Does not Exist --> CreateEpoch[Create Epoch Object]
CheckEpoch -- not found --> CreateEpoch[Create Epoch Object]
CheckEpoch -- Exists --> CheckFailedGateway{Check Failed Gateway}
CreateEpoch -- Created --> CheckFailedGateway{Check Failed Gateway}
CheckFailedGateway -- Valid --> ProcessFailedGateway{Check existing gateway failures}
CheckFailedGateway -- Invalid --> Skip
Skip --> UpdateObserverReportTxId[Update Observer Report Tx Id]
ProcessFailedGateway -- Does not Exist --> CreateFailedGateway[Create Failed Gateway Object]
ProcessFailedGateway -- not found --> CreateFailedGateway[Create Failed Gateway Object]
ProcessFailedGateway -- Exists --> UpdateFailedGateway[Update Failed Gateway Object]
UpdateFailedGateway -- Updated --> UpdateObserverReportTxId[Update Observer Report Tx Id]
CreateFailedGateway -- Created --> UpdateObserverReportTxId[Update Observer Report Tx Id]
Expand Down
200 changes: 200 additions & 0 deletions spec/arns_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe("arns", function()
[testAddressArweave] = startBalance,
[testAddressEth] = startBalance,
}
_G.DemandFactor.currentDemandFactor = 1.0
end)

for addressType, testAddress in pairs(testAddresses) do
Expand Down Expand Up @@ -424,6 +425,81 @@ describe("arns", function()
end)
end

describe("getTokenCost", function()
it("should return the correct token cost for a lease", function()
local baseFee = 500000000
local years = 2
local demandFactor = 0.974
local expectedCost = math.floor((years * baseFee * 0.20) + baseFee) * demandFactor
local intendedAction = {
intent = "Buy-Record",
purchaseType = "lease",
years = 2,
name = "test-name",
}
_G.DemandFactor.currentDemandFactor = demandFactor
assert.are.equal(expectedCost, arns.getTokenCost(intendedAction))
end)
it("should return the correct token cost for a permabuy", function()
local baseFee = 500000000
local demandFactor = 1.052
local expectedCost = math.floor((baseFee * 0.2 * 20) + baseFee) * demandFactor
local intendedAction = {
intent = "Buy-Record",
purchaseType = "permabuy",
name = "test-name",
}
_G.DemandFactor.currentDemandFactor = demandFactor
assert.are.equal(expectedCost, arns.getTokenCost(intendedAction))
end)
it("should return the correct token cost for an undername", function()
_G.NameRegistry.records["test-name"] = {
endTimestamp = constants.oneYearMs,
processId = testProcessId,
purchasePrice = 600000000,
startTimestamp = 0,
type = "lease",
undernameLimit = 10,
}
local baseFee = 500000000
local undernamePercentageFee = 0.001
local increaseQty = 5
local demandFactor = 0.60137
local yearsRemaining = 0.5
local expectedCost =
math.floor(baseFee * increaseQty * undernamePercentageFee * yearsRemaining * demandFactor)
local intendedAction = {
intent = "Increase-Undername-Limit",
quantity = 5,
name = "test-name",
currentTimestamp = constants.oneYearMs / 2,
}
_G.DemandFactor.currentDemandFactor = demandFactor
assert.are.equal(expectedCost, arns.getTokenCost(intendedAction))
end)
it("should return the token cost for extending a name", function()
_G.NameRegistry.records["test-name"] = {
endTimestamp = timestamp + constants.oneYearMs,
processId = testProcessId,
purchasePrice = 600000000,
startTimestamp = 0,
type = "lease",
undernameLimit = 10,
}
local baseFee = 500000000
local years = 2
local demandFactor = 1.2405
local expectedCost = math.floor((years * baseFee * 0.20) * demandFactor)
local intendedAction = {
intent = "Extend-Lease",
years = 2,
name = "test-name",
}
_G.DemandFactor.currentDemandFactor = demandFactor
assert.are.equal(expectedCost, arns.getTokenCost(intendedAction))
end)
end)

describe("pruneRecords", function()
it("should prune records", function()
local currentTimestamp = 1000000000
Expand Down Expand Up @@ -529,4 +605,128 @@ describe("arns", function()
assert.are.equal(registrationFees["51"].lease["1"], 480000000)
end)
end)

describe("getPaginatedRecords", function()
before_each(function()
_G.NameRegistry = {
records = {
["active-record"] = {
endTimestamp = 100, -- far in the future
processId = "oldest-process-id",
purchasePrice = 600000000,
startTimestamp = 0,
type = "lease",
undernameLimit = 10,
},
["active-record-1"] = {
endTimestamp = 10000,
processId = "middle-process-id",
purchasePrice = 400000000,
startTimestamp = 0,
type = "lease",
undernameLimit = 5,
},
["active-record-2"] = {
endTimestamp = 10000000,
processId = "newest-process-id",
purchasePrice = 500000000,
startTimestamp = 0,
type = "lease",
undernameLimit = 8,
},
["permabuy-record"] = {
endTimestamp = nil,
processId = "permabuy-process-id",
purchasePrice = 600000000,
startTimestamp = 0,
type = "permabuy",
undernameLimit = 10,
},
},
}
end)

it("should return the correct paginated records with ascending putting permabuy at the end", function()
local paginatedRecords = arns.getPaginatedRecords(nil, 1, "endTimestamp", "asc")
assert.are.same({
limit = 1,
sortBy = "endTimestamp",
sortOrder = "asc",
hasMore = true,
totalItems = 4,
nextCursor = "active-record",
items = {
{
name = "active-record",
endTimestamp = 100,
processId = "oldest-process-id",
purchasePrice = 600000000,
startTimestamp = 0,
type = "lease",
undernameLimit = 10,
},
},
}, paginatedRecords)
local paginatedRecords2 = arns.getPaginatedRecords(paginatedRecords.nextCursor, 1, "endTimestamp", "asc")
assert.are.same({
limit = 1,
sortBy = "endTimestamp",
sortOrder = "asc",
hasMore = true,
totalItems = 4,
nextCursor = "active-record-1",
items = {
{
name = "active-record-1",
endTimestamp = 10000,
processId = "middle-process-id",
purchasePrice = 400000000,
startTimestamp = 0,
type = "lease",
undernameLimit = 5,
},
},
}, paginatedRecords2)
local paginatedRecords3 = arns.getPaginatedRecords(paginatedRecords2.nextCursor, 1, "endTimestamp", "asc")
assert.are.same({
limit = 1,
sortBy = "endTimestamp",
sortOrder = "asc",
hasMore = true,
totalItems = 4,
nextCursor = "active-record-2",
items = {
{
name = "active-record-2",
endTimestamp = 10000000,
processId = "newest-process-id",
purchasePrice = 500000000,
startTimestamp = 0,
type = "lease",
undernameLimit = 8,
},
},
}, paginatedRecords3)
local paginatedRecords4 = arns.getPaginatedRecords(paginatedRecords3.nextCursor, 1, "endTimestamp", "asc")
assert.are.same({
limit = 1,
sortBy = "endTimestamp",
sortOrder = "asc",
hasMore = false,
totalItems = 4,
nextCursor = nil,
items = {
{
name = "permabuy-record",
endTimestamp = nil,
processId = "permabuy-process-id",
purchasePrice = 600000000,
startTimestamp = 0,
type = "permabuy",
undernameLimit = 10,
},
},
}, paginatedRecords4)
end)
end)
end)
19 changes: 19 additions & 0 deletions spec/balances_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,23 @@ describe("balances", function()
assert.are.equal(0, balances.getBalance(testAddress2))
assert.are.equal(100, balances.getBalance(testAddress1))
end)

describe("getPaginatedBalances", function()
it("should return paginated balances", function()
local balances = balances.getPaginatedBalances(nil, 10, "balance", "desc")
assert.are.same(balances, {
limit = 10,
sortBy = "balance",
sortOrder = "desc",
hasMore = false,
totalItems = 1,
items = {
{
address = testAddress1,
balance = 100,
},
},
})
end)
end)
end)
Loading
Loading