Skip to content

feat(json_rpc): implement new get_data_request - #2631

Closed
guidiaz wants to merge 5 commits into
witnet:masterfrom
guidiaz:json_rpc/get_data_request
Closed

feat(json_rpc): implement new get_data_request#2631
guidiaz wants to merge 5 commits into
witnet:masterfrom
guidiaz:json_rpc/get_data_request

Conversation

@guidiaz

@guidiaz guidiaz commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

Close #2628

Committing,
/// A data request transaction that got included in a block and is currently in REVEAL phase.
Revealing,
/// A data request transaction that got solved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are we missing the Tallying stage here?

@guidiaz guidiaz Jul 9, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not relevant for the method caller. Moreover, isn't the tally transaction expected to be included within the same block as the (last) reveal transactions?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not relevant for the method caller. Moreover, isn't the tally transaction expected to be included at the same time as the (last) reveal transactions?

Not the case yet. Tallying still takes place in the next block after the one that includes the last reveal transaction(s).

Comment thread node/src/actors/json_rpc/api.rs Outdated
Comment on lines +2803 to +2812
query: get_dr_query_params(hash).await.ok(),
result: if let Some(confirmations) = confirmations {
Some(DataRequestQueryResult {
cbor_bytes: hex::encode(report.tally.unwrap_or_default().tally),
confirmations,
timestamp: timestamp.unwrap_or_default(),
})
} else {
None
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's try to have query and result as variables above so the return structure is free from business logic.

Comment thread node/src/actors/json_rpc/api.rs Outdated
Comment on lines +2804 to +2812
result: if let Some(confirmations) = confirmations {
Some(DataRequestQueryResult {
cbor_bytes: hex::encode(report.tally.unwrap_or_default().tally),
confirmations,
timestamp: timestamp.unwrap_or_default(),
})
} else {
None
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This block looks like an Option<_>::map:

let result = confirmations.map(|confirmations| DataRequestQueryResult {
    cbor_bytes: hex::encode(report.tally.unwrap_or_default().tally),
    confirmations,
    timestamp: timestamp.unwrap_or_default(),
})

@guidiaz
guidiaz force-pushed the json_rpc/get_data_request branch from 3a03bd1 to b207ed9 Compare July 10, 2025 07:36
Comment thread node/src/actors/json_rpc/api.rs Outdated
force: bool,
}

/// Enumerates all the states in which a data reuqest transaction can be.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Enumerates all the states in which a data reuqest transaction can be.
/// Enumerates all the states in which a data request transaction can be.

@Tommytrg

Copy link
Copy Markdown
Contributor

LGTM, can we merge it in 2.1 branch and release from there?

@Tommytrg

Copy link
Copy Markdown
Contributor

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.

[JSON RPC] Implement "ethereal" mode on getDataRequest

3 participants