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

Test payload serialization #5

Merged
merged 7 commits into from
May 15, 2024
Merged

Test payload serialization #5

merged 7 commits into from
May 15, 2024

Conversation

m-chrzan
Copy link
Contributor

  • Added a few more conditions in existing payload tests.
  • Added payload generation with private key rather than prepared signature.
  • Added tests with two data packages.
  • (most importantly) Added tests that pass the serialized payload to RedStone's deserializer, verify it deserializes correctly.

Two slight concerns that I noticed while going through the deserialization code:

  • The aggregateValues hook has to be view. This is the only place where we have access to the array of values in a report batch. Initially I had thought this would have been the function where we implement most of our functionality, but we can't write to storage/call other contracts from here. We might be able to work around this by encoding aggregated data (specifically, isWithinAllowedDeviation, isCertain) in the return value of this function (it returns uint256 while our rate feed values fit in uint64).
  • The deserializer takes into account only uniqueSignersThreshold values. It won't bother passing more into aggregateValues if there's more in the batch. This could cause two problems:
    • Slightly reduces security, by forcing the Oracle to always operate at the minimum allowed number of operators taken into account.
    • Could bias the median, given we're expecting the list of values in a batch to be sorted (so values from one extreme will be cut off by this behavior).

Copy link
Collaborator

@chapati23 chapati23 left a comment

Choose a reason for hiding this comment

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

just a general question: are the tests supposed to be passing already or no? just saw failing CI

@m-chrzan
Copy link
Contributor Author

m-chrzan commented May 14, 2024

just a general question: are the tests supposed to be passing already or no? just saw failing CI

The Oracles.sol ones don't need to - that's where I've set up some scaffolding tests prior to code implementation. The payload and OracleValue tests should be passing.

@chapati23 chapati23 merged commit 662ee77 into main May 15, 2024
1 check failed
@chapati23 chapati23 deleted the m-chrzan/payload-testing branch May 15, 2024 16:01
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.

2 participants