-
Notifications
You must be signed in to change notification settings - Fork 208
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
Billing #154
Conversation
Pull Request Test Coverage Report for Build 124
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Couple comments inline.
app/app.go
Outdated
@@ -235,6 +235,8 @@ func (app *app) Commit() tmtypes.ResponseCommit { | |||
app.mfacilitator.OnCommit(app.state) | |||
} | |||
|
|||
lease.ProcessLeases(app.state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.Error()
or similar.
app/market/engine_test.go
Outdated
for idx := range groups.GetItems() { | ||
require.NoError(t, state_.DeploymentGroup().Save(groups.GetItems()[idx])) | ||
require.NoError(t, state.DeploymentGroup().Save(groups.GetItems()[idx])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be able to do the
for _, item := range groups.GetItems() {
require.NoError(t,state.Save(item))
}
thing here.
cmd/akashd/init.go
Outdated
) | ||
|
||
const ( | ||
maxTokens uint64 = 1000000000 | ||
maxTokens uint64 = math.MaxUint64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will screw up the integration tests here.
- Simple matter of changing the value in the test or ideally just referencing a constant.
- The json lib we're using there maxes out at
int64
which won't be able to holdmath.MaxUint64
. - Also, I think we're supposed to have a billion tokens total.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it read it as -1
:
Evaluation of main failed:
/main/account-send/account-balance/akash: ../akash -d ./data/client query account 22CDFF3E908986DE2F4B1D279667BA02B84CD7D6: balance: received -1 expected 1000000000
-===[BEGIN STDOUT]===-
{
"address": "22CDFF3E908986DE2F4B1D279667BA02B84CD7D6",
"balance": 18446744073709551615
}
testutil/state.go
Outdated
@@ -20,6 +21,7 @@ func CreateAccount(t *testing.T, state state.State) (*types.Account, crypto.Priv | |||
key := PrivateKey(t) | |||
account := &types.Account{ | |||
Address: key.PubKey().Address(), | |||
Balance: math.MaxUint64 / 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah let's do a constant somewhere for initial token count.
@@ -87,7 +87,7 @@ func (e engine) processDeployment(state state.State, w txBuffer, deployment type | |||
if !activeFound && order.State == types.Order_OPEN || order.State == types.Order_MATCHED { | |||
activeFound = true | |||
} | |||
if order.EndAt <= height { | |||
if order.State == types.Order_OPEN && order.EndAt <= height { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
fixes #142
fixes #151
On lease create, check if tenant has balance >= lease price
process leases in market engine
for each active lease, send a billTenantTx
Lease app accepts and checks BillTenantTx
Lease app subtracts lease.Price from the tenant and sends lease.Price to the provider.