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/radon/object pruning #2416

Open
wants to merge 35 commits into
base: 2.0-base
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5bbea50
feat: implement HttpHead as new RADType
guidiaz Oct 10, 2023
3fdf8f9
chore: cargo fmt --all
guidiaz Oct 10, 2023
721347a
feat: handle repeated headers within http/head response
guidiaz Oct 11, 2023
ef30733
test: run valid http head retrieval
guidiaz Oct 11, 2023
a665397
test: try http-head data request w/ invalid request header
guidiaz Oct 11, 2023
198e5b8
chore: bump package versions
guidiaz Oct 11, 2023
9bae448
chore: cargo fmt --all
guidiaz Oct 11, 2023
af5ff86
chore: solve clippy warnings
guidiaz Oct 11, 2023
ac57ded
fix: use http::Response::headers(&self) to transform response to HTTP…
guidiaz Oct 11, 2023
5e073f9
chore: attend pr review comments
guidiaz Oct 20, 2023
6c4d1ac
feat(rad): add support to binary sources
guidiaz Oct 20, 2023
0cfd81d
chore(rad): refactor existing tests
guidiaz Oct 20, 2023
68c7648
chore: attend pr review comments
guidiaz Oct 26, 2023
184f768
chore: cargo clippy --fix
guidiaz Oct 26, 2023
cd4641c
feat(rad): add new RadonErrors::BufferIsNotValue
guidiaz Oct 26, 2023
f1314a4
fix(rad): http-head response headers can contain 'accept-ranges'
guidiaz Nov 14, 2023
1f2402b
feat(rad): implement StringReplace
guidiaz Nov 14, 2023
533c103
feat(rad): implement StringSlice
guidiaz Nov 14, 2023
b3322b1
feat(rad): implement StringSplit
guidiaz Nov 14, 2023
88c8674
feat(rad): first approach to ArrayJoin
guidiaz Nov 14, 2023
0ab36ce
chore(rad): rename asX <-> toX depending on whether conversion may fail
guidiaz Dec 13, 2023
1c7a4a2
feat(rad): implement RadonOpCodes::BytesAsInteger
guidiaz Dec 13, 2023
ae50ed8
feat(rad): support multiple encoding schemas on RadonOpCodes::BytesSt…
guidiaz Dec 13, 2023
888ef3b
feat(rad): implement RadonOpCodes::IntegerToBytes
guidiaz Dec 13, 2023
179503c
feat(rad): implement RadonOpCodes::StringAsBytes
guidiaz Dec 13, 2023
6802cad
feat(rad): include retrieval response time within WitnetResultReports
guidiaz Dec 13, 2023
73d49e7
feat: implement RadonOpCodes::ArrayPick
guidiaz Jan 10, 2024
3ce8d2d
feat: implement RadonOpCodes::MapStringify
guidiaz Jan 10, 2024
aae16d2
feat: implement RadonOpCodes::MapAlter
guidiaz Jan 10, 2024
f492676
feat: implement RadonOpCodes::MapPick
guidiaz Jan 10, 2024
f222ee5
feat: support optional json path as first argument on RadonOpCodes::S…
guidiaz Jan 10, 2024
616958b
feat: support optional json path as first argument on RadonOpCodes::S…
guidiaz Jan 10, 2024
2506613
chore: cargo clippy --fix
guidiaz Jan 10, 2024
d03ce84
chore: cargo fmt
guidiaz Jan 12, 2024
d066a4d
fix: failing radon error tests
guidiaz Jan 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 93 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "witnet"
version = "1.6.7"
version = "2.0.0"
authors = ["Witnet Foundation <info@witnet.foundation>"]
publish = false
repository = "witnet/witnet-rust"
Expand Down
2 changes: 1 addition & 1 deletion bridges/centralized-ethereum/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "witnet-centralized-ethereum-bridge"
version = "1.6.7"
version = "2.0.0"
authors = ["Witnet Foundation <info@witnet.foundation>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion data_structures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors = ["Witnet Foundation <info@witnet.foundation>"]
description = "data structures component"
edition = "2021"
name = "witnet_data_structures"
version = "1.6.7"
version = "2.0.0"
workspace = ".."

[features]
Expand Down
17 changes: 13 additions & 4 deletions data_structures/src/chain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1645,11 +1645,17 @@ pub enum RADType {
/// HTTP POST request
#[serde(rename = "HTTP-POST")]
HttpPost,
/// HTTP HEAD request
#[serde(rename = "HTTP-HEAD")]
HttpHead,
}

impl RADType {
pub fn is_http(&self) -> bool {
matches!(self, RADType::HttpGet | RADType::HttpPost)
matches!(
self,
RADType::HttpGet | RADType::HttpPost | RADType::HttpHead
)
}
}

Expand Down Expand Up @@ -1701,7 +1707,7 @@ pub struct RADRetrieve {
pub script: Vec<u8>,
/// Body of a HTTP-POST request
pub body: Vec<u8>,
/// Extra headers of a HTTP-GET or HTTP-POST request
/// Extra headers of a HTTP-GET, HTTP-POST or HTTP-HEAD request
pub headers: Vec<(String, String)>,
}

Expand Down Expand Up @@ -1810,6 +1816,9 @@ impl RADRetrieve {
&[Field::Body, Field::Headers],
)
}
RADType::HttpHead => {
check(&[Field::Kind, Field::Url, Field::Script], &[Field::Headers])
}
}
}

Expand Down Expand Up @@ -2681,7 +2690,7 @@ impl TransactionsPool {
for input in &vt_tx.body.inputs {
self.output_pointer_map
.entry(input.output_pointer)
.or_insert_with(Vec::new)
.or_default()
.push(vt_tx.hash());
}

Expand All @@ -2706,7 +2715,7 @@ impl TransactionsPool {
for input in &dr_tx.body.inputs {
self.output_pointer_map
.entry(input.output_pointer)
.or_insert_with(Vec::new)
.or_default()
.push(dr_tx.hash());
}

Expand Down
2 changes: 1 addition & 1 deletion data_structures/src/data_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl DataRequestPool {

self.data_requests_by_epoch
.entry(epoch)
.or_insert_with(HashSet::new)
.or_default()
.insert(dr_hash);
self.data_request_pool.insert(dr_hash, dr_state);

Expand Down
2 changes: 2 additions & 0 deletions data_structures/src/proto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ impl ProtobufConvert for chain::RADType {
chain::RADType::HttpGet => witnet::DataRequestOutput_RADRequest_RADType::HttpGet,
chain::RADType::Rng => witnet::DataRequestOutput_RADRequest_RADType::Rng,
chain::RADType::HttpPost => witnet::DataRequestOutput_RADRequest_RADType::HttpPost,
chain::RADType::HttpHead => witnet::DataRequestOutput_RADRequest_RADType::HttpHead,
}
}

Expand All @@ -60,6 +61,7 @@ impl ProtobufConvert for chain::RADType {
witnet::DataRequestOutput_RADRequest_RADType::HttpGet => chain::RADType::HttpGet,
witnet::DataRequestOutput_RADRequest_RADType::Rng => chain::RADType::Rng,
witnet::DataRequestOutput_RADRequest_RADType::HttpPost => chain::RADType::HttpPost,
witnet::DataRequestOutput_RADRequest_RADType::HttpHead => chain::RADType::HttpHead,
})
}
}
Expand Down
2 changes: 2 additions & 0 deletions data_structures/src/radon_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ pub enum RadonErrors {
HTTPError = 0x30,
/// Al least one of the sources could not be retrieved, timeout reached.
RetrieveTimeout = 0x31,
/// Value cannot be extracted from binary buffer
BufferIsNotValue = 0x32,
// Math errors
/// Math operator caused an underflow.
Underflow = 0x40,
Expand Down
4 changes: 2 additions & 2 deletions data_structures/src/serialization_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ struct RADRetrieveSerializationHelperJson {
/// Body of a HTTP-POST request
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub body: Vec<u8>,
/// Extra headers of a HTTP-GET or HTTP-POST request
/// Extra headers of a HTTP-GET, HTTP-HEAD or HTTP-POST request
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub headers: Vec<(String, String)>,
}
Expand All @@ -377,7 +377,7 @@ struct RADRetrieveSerializationHelperBincode {
pub script: Vec<u8>,
/// Body of a HTTP-POST request
pub body: Vec<u8>,
/// Extra headers of a HTTP-GET or HTTP-POST request
/// Extra headers of a HTTP-GET, HTTP-HEAD or HTTP-POST request
pub headers: Vec<(String, String)>,
}

Expand Down
2 changes: 1 addition & 1 deletion net/src/client/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ pub struct WitnetHttpResponse {

impl WitnetHttpResponse {
#[inline]
/// Simple wrapper around `isahc::Response::status`.
/// Simple wrapper around `isahc::Response`.
pub fn inner(self) -> isahc::Response<isahc::AsyncBody> {
self.res
}
Expand Down
Loading
Loading