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

Subintent hash at device side #75

Open
wants to merge 53 commits into
base: develop
Choose a base branch
from

Conversation

siy
Copy link
Collaborator

@siy siy commented Oct 1, 2024

Implement calculation of the subintent pre-auth hash calculation on device.

siy added 30 commits October 1, 2024 16:18
…es correctly, but final hash is still incorrect; only one test vector)
# Conflicts:
#	doc/api.md
#	src/command.rs
#	src/handler.rs
#	src/handler/dispatcher.rs
#	src/handler/sign_preauth_hash_ed25519.rs
#	src/sign/instruction_processor.rs
#	src/sign/sign_mode.rs
#	src/sign/signing_flow_state.rs
#	src/sign/tx_state.rs
#	src/xui/introductory_screen.rs
…hash-at-device-side

# Conflicts:
#	doc/api.md
#	src/command.rs
…t-hash-at-device-side

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	sbor/src/digest/hash_calculator.rs
#	src/command.rs
#	src/handler/dispatcher.rs
Copy link
Contributor

@CyonAlexRDX CyonAlexRDX left a comment

Choose a reason for hiding this comment

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

Many docs are still broken

@@ -6,6 +6,7 @@ use crate::static_vec::StaticVec;
#[derive(Copy, Clone)]
pub struct PreciseDecimal(BigInt<256>);

/// Ledger app-specific counterpart of the Scrypto PreciseDecimal type
Copy link
Contributor

Choose a reason for hiding this comment

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

incorrectly place doc, should go on top of derive on top of PreciseDecimal

@@ -6,6 +6,7 @@ use crate::static_vec::StaticVec;
#[derive(Copy, Clone, Debug)]
pub struct Decimal(BigInt<192>);

/// Ledger app-specific counterpart of the Scrypto Decimal type
Copy link
Contributor

Choose a reason for hiding this comment

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

incorrectly place doc, should go on top of derive on top of Decimal

@@ -1,5 +1,7 @@
// Process events received from decoder and extract data related to instructions

/// Process events received from SBOR decoder and extract data related to each instruction
Copy link
Contributor

Choose a reason for hiding this comment

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

incorrect doc, if this doc is for this file, then you should use //!, or put docs on top of types.

@@ -1,4 +1,4 @@
// Instructions recognized by instruction extractor
/// Instructions recognized by instruction extractor
Copy link
Contributor

Choose a reason for hiding this comment

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

incorrect doc, there is an empty space between this doc and the type enum Instruction, the doc must go on top of #[repr()u8], without newline between. And every line in the doc must be ///

@@ -57,11 +60,11 @@ pub const TITLE_SIZE: usize = 32;
pub struct ParameterPrinterState<T: Copy> {
pub display: StaticVec<u8, { DISPLAY_SIZE }>,
pub data: StaticVec<u8, { PARAMETER_AREA_SIZE }>,
pub title: StaticVec<u8, { TITLE_SIZE }>,
pub title: StaticVec<u8, { TITLE_SIZE }>, // Intermediate buffer for formatting instruction titles (instruction number)
Copy link
Contributor

Choose a reason for hiding this comment

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

docs must go op top of field, or are you "waiting" with that until last minute? just dont forget :)

/// information about fees.
/// Implementation consists of two independent state machines - one for detecting the intent type and
/// other to collect fee information. Both of them use information about decoded instructions
/// received from `InstructionExtractor`.
Copy link
Contributor

Choose a reason for hiding this comment

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

incorrect doc, either use //! for documenting the whole file, or attach the doc to some specific type.

pub dst_address: Address,
pub res_address: Address,
pub amount: Decimal,
pub src_address: Address, // From ...
Copy link
Contributor

Choose a reason for hiding this comment

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

don't forget to fix doc for fields...

@@ -1,22 +1,21 @@
// SBOR decoder
/// Streaming decoder for SBOR format
Copy link
Contributor

Choose a reason for hiding this comment

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

//!

// https://en.wikipedia.org/wiki/Double_dabble
/// Implementation of the simple BCD convertor/accumulator
/// Algorithm is a quite straightforward implementation of the double-dabble algorithm.
/// https://en.wikipedia.org/wiki/Double_dabble

Copy link
Contributor

Choose a reason for hiding this comment

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

remove newline in doc, must be /// otherwise doc is broken.

Base automatically changed from develop to main November 5, 2024 06:40
@CyonAlexRDX CyonAlexRDX changed the base branch from main to develop November 5, 2024 10:53
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.

3 participants