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

feat: data validation handler #20

Merged
merged 17 commits into from
Dec 13, 2022
Merged

feat: data validation handler #20

merged 17 commits into from
Dec 13, 2022

Conversation

0xHansLee
Copy link
Contributor

@0xHansLee 0xHansLee commented Dec 7, 2022

close #6

@0xHansLee 0xHansLee added this to the v2.1.0-beta milestone Dec 7, 2022
@0xHansLee 0xHansLee self-assigned this Dec 7, 2022
@0xHansLee 0xHansLee linked an issue Dec 7, 2022 that may be closed by this pull request
Base automatically changed from ft/15/start to main December 8, 2022 06:40
H4NLee added 5 commits December 8, 2022 16:08
# Conflicts:
#	cmd/oracled/cmd/root.go
#	service/handler.go
# Conflicts:
#	go.mod
#	panacea/query_client.go
@0xHansLee
Copy link
Contributor Author

I have not tested full cycle of this handler because some relevant functions of Panacea are in developing.
After implementation of those, I'll test it.

@0xHansLee 0xHansLee marked this pull request as ready for review December 12, 2022 01:10
@0xHansLee
Copy link
Contributor Author

I can make test codes for this handler as youngjoon did for auth_test.go.
Will add soon

Copy link
Contributor

@gyuguen gyuguen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.
I left a few comments.

ProviderAddress string `json:"provider_address"`
EncryptedDataBase64 string `json:"encrypted_data_base64"`
DataHash string `json:"data_hash"`
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about added validation function like func (m ValidateDataReq) ValidateBasic() {...}.
This is a validation of request parameters.

http.Error(w, "failed to get deal", http.StatusBadRequest)
return
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about added validation a deal status?

service/handler.go Outdated Show resolved Hide resolved
Copy link
Contributor

@youngjoon-lee youngjoon-lee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving merging this PR in general, but it seems there are some duplicated codes with PR #21, in regard to the AES encryption.

Copy link
Contributor

@audtlr24 audtlr24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, lgtm

@0xHansLee
Copy link
Contributor Author

I tried to write test for this handler, but it requires to mock service, and many components inside service (query client, ipfs, etc.).
So I decided not to write test for this handler using mocking. I think we need to test this in e2e test.

@youngjoon-lee
Copy link
Contributor

I tried to write test for this handler, but it requires to mock service, and many components inside service (query client, ipfs, etc.).
So I decided not to write test for this handler using mocking. I think we need to test this in e2e test.

Yup. No worries :)

Copy link
Contributor

@inchori inchori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

)

// Encrypt combines secretKey and secondKey to encrypt with AES256-GCM method.
func Encrypt(secretKey, additional, data []byte) ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, If these functions are merged into main branch, I'll change it when executing approveOracleRegistration tx.

H4NLee added 4 commits December 13, 2022 14:19
# Conflicts:
#	go.sum
#	panacea/query_client.go
#	server/middleware/auth_test.go
@0xHansLee 0xHansLee merged commit 77b1a13 into main Dec 13, 2022
@0xHansLee 0xHansLee deleted the ft/6/handler branch December 13, 2022 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle data validation requests
5 participants