linera-io / linera-protocol

Main repository for the Linera protocol
Apache License 2.0
112 stars 94 forks source link

Don't use `Some(OracleRecord::default())` as oracle in tests #2204

Closed andresilva91 closed 4 days ago

andresilva91 commented 4 days ago

Motivation

Right now for user actions if the OracleRecord is Some, we set OracleResponses to Replay, regardless of what the OracleRecord contains. On the system API calls that deal with Replay, the pattern we see is that if the OracleResponses is set to Replay, we'll try to replay the OracleResponses inside. If we have no OracleResponses inside, we'll error out with ExecutionError::MissingOracleResponse. The pattern we see on tests right now is to pass Some(OracleRecord::default()) as the OracleRecord, which will generate a set of empty OracleResponses, which would fail. The reason it doesn't fail right now is that we don't test these system API calls using this pattern.

Proposal

All that is to say that I believe the pattern we should use is None as the OracleRecord, because we should always be "recording" in tests, because it'll likely be the first time we're running things. So I'm altering the code to follow that pattern instead, as I believe it's more correct. There's a chance we're setting Replay/Record in a wrong way, but I'm not sure, so open to comments if that's the case.

Test Plan

CI

andresilva91 commented 4 days ago

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @andresilva91 and the rest of your teammates on Graphite Graphite