-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: dod settlement rpc patch #1124
Conversation
Signed-off-by: lichao <chao.li@qlink.mobi>
Signed-off-by: lichao <chao.li@qlink.mobi>
Signed-off-by: lichao <chao.li@qlink.mobi>
Signed-off-by: lichao <chao.li@qlink.mobi>
Signed-off-by: lichao <chao.li@qlink.mobi>
@@ -428,6 +428,36 @@ func DoDSettleGetConnectionRawParam(ctx *vmstore.VMContext, id types.Hash) (*DoD | |||
return cp, nil | |||
} | |||
|
|||
func DoDSettleInheritRawParam(src *DoDSettleConnectionRawParam, dst *DoDSettleConnectionParam) { |
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.
[golangci-lint] reported by reviewdog 🐶
431-459 lines are duplicate of vm/contract/abi/abi_dod_settlement.go:461-489
(dupl)
Codecov Report
@@ Coverage Diff @@
## master #1124 +/- ##
==========================================
+ Coverage 71.65% 71.72% +0.06%
==========================================
Files 297 297
Lines 36256 36330 +74
==========================================
+ Hits 25980 26057 +77
+ Misses 6855 6845 -10
- Partials 3421 3428 +7
Continue to review full report at Codecov.
|
Signed-off-by: lichao <chao.li@qlink.mobi>
@@ -428,6 +439,36 @@ func DoDSettleGetConnectionRawParam(ctx *vmstore.VMContext, id types.Hash) (*DoD | |||
return cp, nil | |||
} | |||
|
|||
func DoDSettleInheritRawParam(src *DoDSettleConnectionRawParam, dst *DoDSettleConnectionParam) { |
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.
[golangci-lint] reported by reviewdog 🐶
442-470 lines are duplicate of vm/contract/abi/abi_dod_settlement.go:472-500
(dupl)
@@ -520,7 +561,7 @@ func DoDSettleGetOrderIdListByAddress(ctx *vmstore.VMContext, address types.Addr | |||
return userInfo.OrderIds, nil | |||
} | |||
|
|||
func DodSettleGetOrderInvoice(ctx *vmstore.VMContext, seller types.Address, order *DoDSettleOrderInfo, start, end int64, flight, split bool) (*DoDSettleInvoiceOrderDetail, error) { | |||
func DoDSettleGetOrderInvoice(ctx *vmstore.VMContext, seller types.Address, order *DoDSettleOrderInfo, start, end int64, flight, split bool) (*DoDSettleInvoiceOrderDetail, error) { |
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.
[golangci-lint] reported by reviewdog 🐶
Function 'DoDSettleGetOrderInvoice' has too many statements (52 > 50) (funlen)
@@ -726,7 +779,7 @@ func DodSettleGetOrderInvoice(ctx *vmstore.VMContext, seller types.Address, orde | |||
return invoiceOrder, nil | |||
} | |||
|
|||
func DodSettleGetProductInvoice(conn *DoDSettleConnectionInfo, start, end int64, flight, split bool) (*DoDSettleInvoiceConnDetail, error) { | |||
func DoDSettleGetProductInvoice(conn *DoDSettleConnectionInfo, start, end int64, flight, split bool) (*DoDSettleInvoiceConnDetail, error) { |
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.
[golangci-lint] reported by reviewdog 🐶
Function 'DoDSettleGetProductInvoice' has too many statements (54 > 50) (funlen)
@@ -992,7 +1075,7 @@ func DodSettleGenerateInvoiceByProduct(ctx *vmstore.VMContext, seller types.Addr | |||
return invoice, nil | |||
} | |||
|
|||
func DodSettleGenerateInvoiceByBuyer(ctx *vmstore.VMContext, seller, buyer types.Address, start, end int64, flight, split bool) (*DoDSettleBuyerInvoice, error) { | |||
func DoDSettleGenerateInvoiceByBuyer(ctx *vmstore.VMContext, seller, buyer types.Address, start, end int64, flight, split bool) (*DoDSettleBuyerInvoice, error) { |
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.
[golangci-lint] reported by reviewdog 🐶
cyclomatic complexity 16 of func DoDSettleGenerateInvoiceByBuyer
is high (> 15) (gocyclo)
@@ -608,14 +653,14 @@ func TestDodSettleGenerateInvoiceByOrder(t *testing.T) { | |||
|
|||
start = int64(4000) | |||
end = int64(0) | |||
invoice, err = DodSettleGenerateInvoiceByOrder(ctx, seller, order.OrderId, start, end, true, false) | |||
invoice, err = DoDSettleGenerateInvoiceByOrder(ctx, seller, order.OrderId, start, end, true, false) |
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.
[golangci-lint] reported by reviewdog 🐶
SA4006: this value of invoice
is never used (staticcheck)
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
start = int64(0) | ||
end = int64(1000) | ||
invoice, err = DodSettleGenerateInvoiceByOrder(ctx, seller, order.OrderId, start, end, false, true) | ||
invoice, err = DoDSettleGenerateInvoiceByOrder(ctx, seller, order.OrderId, start, end, false, true) |
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.
[golangci-lint] reported by reviewdog 🐶
SA4006: this value of invoice
is never used (staticcheck)
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
start = int64(12000) | ||
end = int64(15000) | ||
invoice, err = DodSettleGenerateInvoiceByProduct(ctx, seller, conn2.ProductId, start, end, true, true) | ||
invoice, err = DoDSettleGenerateInvoiceByProduct(ctx, seller, conn2.ProductId, start, end, true, true) |
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.
[golangci-lint] reported by reviewdog 🐶
SA4006: this value of invoice
is never used (staticcheck)
Signed-off-by: lichao <chao.li@qlink.mobi>
Signed-off-by: lichao <chao.li@qlink.mobi>
@@ -428,6 +440,36 @@ func DoDSettleGetConnectionRawParam(ctx *vmstore.VMContext, id types.Hash) (*DoD | |||
return cp, nil | |||
} | |||
|
|||
func DoDSettleInheritRawParam(src *DoDSettleConnectionRawParam, dst *DoDSettleConnectionParam) { |
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.
[golangci-lint] reported by reviewdog 🐶
443-471 lines are duplicate of vm/contract/abi/abi_dod_settlement.go:473-501
(dupl)
DstCity: "NYC", | ||
DstDataCenter: "DCY", | ||
DstPort: dstPortP, | ||
ItemId: fmt.Sprintf("item%d", rand.Int()), |
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.
[golangci-lint] reported by reviewdog 🐶
G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)
Proposed changes in this pull request
Type
Checklist
Write a small comment explaining if its
N/A
(not applicable)