arxcode icon indicating copy to clipboard operation
arxcode copied to clipboard

Possible double counting of tax income

Open sgsabbage opened this issue 5 years ago • 0 comments

Hey folks,

I've been doing a bit of a deep dive of the domain system in an attempt to learn how it all works, and in doing so I think I might have found an issue with tax incomes and debts. I may, of course, be incredibly wrong about this.

In do_weekly_adjustment we go over each domain's weekly adjustment: https://github.com/Arx-Game/arxcode/blob/46f3dde18e8f315030ae4d3725f020fd2fa30095/world/dominion/models.py#L1179-L1181

In turn, this calls: https://github.com/Arx-Game/arxcode/blob/46f3dde18e8f315030ae4d3725f020fd2fa30095/world/dominion/domain/models.py#L1265 which gets the total income and costs for the domain.

total_income and costs include tax_income and liege_taxed_amt respectively. https://github.com/Arx-Game/arxcode/blob/46f3dde18e8f315030ae4d3725f020fd2fa30095/world/dominion/domain/models.py#L975 https://github.com/Arx-Game/arxcode/blob/46f3dde18e8f315030ae4d3725f020fd2fa30095/world/dominion/domain/models.py#L1030

These create transactions if necessary. Or at the end of the weekly adjustment, transactions are updated: https://github.com/Arx-Game/arxcode/blob/46f3dde18e8f315030ae4d3725f020fd2fa30095/world/dominion/domain/models.py#L1269

Because total_income and costs include tax_income and liege_taxed_amt, the overall amount that the ruler/house's vaults are adjusted by include these numbers.

But then, after this calculation has been done, the transactions are ALSO fired off at the reset value: https://github.com/Arx-Game/arxcode/blob/46f3dde18e8f315030ae4d3725f020fd2fa30095/world/dominion/models.py#L1184-L1186

So it looks to me that if you're paying, say, 20k in tax and receving 10k in tax what happens is that your costs include that 20k and your total income includes that 10k, making a net change from tax of -10k, and then transactions will also add and subtract those amounts from your vault, making it a net change of -20k.

I don't fully understand the systems, so I may well be making a logical leap that's incorrect in here, but I thought I'd raise it.

sgsabbage avatar Jun 23 '20 12:06 sgsabbage