Skip to content

Commit

Permalink
add file comments
Browse files Browse the repository at this point in the history
  • Loading branch information
abenso committed Nov 20, 2024
1 parent 885d082 commit 0cc4e7e
Show file tree
Hide file tree
Showing 20 changed files with 217 additions and 4 deletions.
16 changes: 16 additions & 0 deletions app/rust/src/address.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use decaf377::Fq;

use crate::keys::dk::Diversifier;
Expand Down
3 changes: 2 additions & 1 deletion app/rust/src/bolos.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* (c) 2018 - 2023 Zondax AG
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

//! Rust interfaces to Ledger SDK APIs.
#[cfg(test)]
use getrandom::getrandom;
Expand Down
2 changes: 1 addition & 1 deletion app/rust/src/parser/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/
// use super::spend::SpendPlan;

use crate::constants::ACTION_DATA_QTY;

#[derive(Clone, Copy, PartialEq, Eq)]
Expand Down
1 change: 1 addition & 0 deletions app/rust/src/parser/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use super::bytes::BytesC;
use crate::ParserError;
#[repr(C)]
Expand Down
16 changes: 16 additions & 0 deletions app/rust/src/parser/amount.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use crate::ParserError;
use decaf377::{Fq, Fr};
use crate::constants::AMOUNT_LEN_BYTES;
Expand Down
16 changes: 16 additions & 0 deletions app/rust/src/parser/balance.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use std::num::NonZeroU128;
use crate::ParserError;
use crate::parser::id::Id;
Expand Down
1 change: 1 addition & 0 deletions app/rust/src/parser/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use crate::ParserError;

#[cfg(any(feature = "derive-debug", test))]
Expand Down
1 change: 1 addition & 0 deletions app/rust/src/parser/clue_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use crate::parser::{address::AddressC, bytes::BytesC};

#[repr(C)]
Expand Down
16 changes: 16 additions & 0 deletions app/rust/src/parser/commitment.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use decaf377::{Element, Fq};

#[derive(Clone, Debug)]
Expand Down
16 changes: 16 additions & 0 deletions app/rust/src/parser/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use arrayvec::CapacityError;
use nom::error::ErrorKind;

Expand Down
16 changes: 16 additions & 0 deletions app/rust/src/parser/id.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use crate::parser::bytes::BytesC;
use crate::ParserError;
use decaf377::Fq;
Expand Down
16 changes: 16 additions & 0 deletions app/rust/src/parser/note.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use crate::address::Address;
use crate::keys::ka;
use crate::keys::ovk::Ovk;
Expand Down
15 changes: 15 additions & 0 deletions app/rust/src/parser/note_payload.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use crate::parser::commitment::StateCommitment;
use crate::parser::note::NoteCiphertext;
Expand Down
16 changes: 16 additions & 0 deletions app/rust/src/parser/nullifier.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use decaf377::Fq;
use poseidon377::hash_3;
use crate::keys::nk::NullifierKey;
Expand Down
1 change: 1 addition & 0 deletions app/rust/src/parser/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use crate::parser::effect_hash::{create_personalized_state, EffectHash};

use super::bytes::BytesC;
Expand Down
1 change: 1 addition & 0 deletions app/rust/src/parser/plans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use crate::parser::{
detection::DetectionDataPlanC,
memo::MemoPlanC,
Expand Down
16 changes: 16 additions & 0 deletions app/rust/src/parser/plans/output.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use crate::address::Address;
use crate::keys::FullViewingKey;
use crate::parser::note::Note;
Expand Down
20 changes: 18 additions & 2 deletions app/rust/src/parser/plans/spend.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use crate::keys::FullViewingKey;
use crate::parser::{
bytes::BytesC,
Expand Down Expand Up @@ -31,7 +47,7 @@ pub struct SpendPlanC {

impl SpendPlanC {
pub fn effect_hash(&self, fvk: &FullViewingKey) -> Result<EffectHash, ParserError> {
let body = self.body(fvk);
let body = self.spend_body(fvk);

if let Ok(body) = body {
let mut state =
Expand All @@ -51,7 +67,7 @@ impl SpendPlanC {
}
}

pub fn body(&self, fvk: &FullViewingKey) -> Result<Body, ParserError> {
pub fn spend_body(&self, fvk: &FullViewingKey) -> Result<Body, ParserError> {
Ok(Body {
balance_commitment: self
.balance()?
Expand Down
16 changes: 16 additions & 0 deletions app/rust/src/parser/rseed.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use decaf377::{Fq, Fr};
use crate::{ParserError, utils::prf};
use crate::parser::bytes::BytesC;
Expand Down
16 changes: 16 additions & 0 deletions app/rust/src/parser/value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* (c) 2024 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/

use crate::parser::{
amount::{Amount, AmountC},
commitment::Commitment,
Expand Down

0 comments on commit 0cc4e7e

Please sign in to comment.