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

Data requests with RADType::Unknown sources are wrongly accepted into blocks since WIP0020 #2332

Open
tmpolaczyk opened this issue Dec 29, 2022 · 0 comments

Comments

@tmpolaczyk
Copy link
Contributor

Data requests with RADType::Unknown sources are wrongly accepted into blocks since WIP0020.

Example transaction: 38d8cf497622082fa8fd4e89831641834918a99472b722310d60664046a29883

{"jsonrpc":"2.0","result":{"blockEpoch":1544550,"blockHash":"3a077d6b4064524afa01e1b8781cfb059693653d5138734b0ffef27253a24bc9","confirmed":true,"transaction":{"DataRequest":{"body":{"dr_output":{"collateral":10000000000,"commit_and_reveal_fee":1000,"data_request":{"aggregate":{"filters":[{"args":[251,63,241,153,153,153,153,153,154],"op":5}],"reducer":3},"retrieve":[{"kind":"Unknown","script":[130,24,119,130,24,101,101,108,105,107,101,115],"url":"https://api-middlewares.vercel.app/api/twitter/tweets/0"}],"tally":{"filters":[{"args":[251,63,241,153,153,153,153,153,154],"op":5}],"reducer":3},"time_lock":1630669134},"min_consensus_percentage":51,"witness_reward":1000000,"witnesses":100},"inputs":[{"output_pointer":"7cc0415818cd633916c4a3d3ea097d13e04973a8be010baea39244d83fa6d6bc:0"}],"outputs":[{"pkh":"wit1c0ucz2u9hwgqflkn4xjeyxtla9tqp0sderzkjr","time_lock":0,"value":2166708072}]},"signatures":[{"public_key":{"bytes":[176,193,72,220,165,255,123,112,10,173,38,116,83,157,103,237,213,54,147,62,72,34,100,153,202,212,153,241,200,151,13,32],"compressed":2},"signature":{"Secp256k1":{"der":[48,69,2,33,0,144,199,29,249,135,183,74,33,30,61,204,36,30,87,98,167,21,127,197,46,46,14,71,113,28,140,180,187,140,181,170,26,2,32,52,178,190,191,36,97,187,28,26,178,118,166,244,232,234,177,76,247,204,102,75,70,54,251,121,21,52,208,151,229,70,15]}}}]}},"weight":64009},"id":"1"}

Summary of the behavior:

  • Before WIP0019: RADType::Unknown are accepted, and treated as HttpGet.
  • WIP0019: RADType::Unknown are rejected.
  • WIP0020: RADType::Unknown are accepted, and resolved with RadonTypes::RadonError(UnhandledIntercept { inner: None, message: Some("inner: UnknownRetrieval") }).

This is implemented in the validate_rad_request function:

pub fn validate_rad_request(

So this looks like a bug introduced when implementing WIP0020. I believe that the intended behavior was to reject RADType::Unknown sources, because they were already being rejected after WIP0019, so that should be fixed.

However, this issue shouldn't have any negative effects on the network, because we used to accept this kind of transactions in the past, and all the other validations are working correctly so it is not possible to abuse this bug to perform double spends or anything like that.

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

No branches or pull requests

1 participant