Skip to content

Commit

Permalink
Merge branch 'main' into immutable_config
Browse files Browse the repository at this point in the history
Signed-off-by: Mykhailo Lohachov <[email protected]>
  • Loading branch information
aoyako authored Nov 29, 2024
2 parents 324a035 + 9271c38 commit e9d1b1b
Show file tree
Hide file tree
Showing 94 changed files with 4,246 additions and 3,490 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/iroha2-doc-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: I2::Doc::Links

# Verify all links in text files and generated documentation
# from source files are valid (return 200-like http code).
# https://github.com/lycheeverse/lychee

on:
pull_request:
branches: [main, stable, lts]
paths:
- '**/*.md'
- '**/*.txt'
- '**/*.html'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
link_checker:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4

- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2
with:
args: "'**/*.rs' ." # Check rust source and default text files
fail: true
6 changes: 2 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ To pass the *`check-PR-title`* check, the pull request title must adhere to the
### Git Workflow

- [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) the [repository](https://github.com/hyperledger-iroha/iroha/tree/main) and [create a feature branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-and-deleting-branches-within-your-repository) for your contributions.
- [Configure the remote](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/configuring-a-remote-for-a-fork) to sync your fork with the [Hyperledger Iroha repository](https://github.com/hyperledger-iroha/iroha/tree/main).
- [Configure the remote](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/configuring-a-remote-repository-for-a-fork) to sync your fork with the [Hyperledger Iroha repository](https://github.com/hyperledger-iroha/iroha/tree/main).
- Use the [Git Rebase Workflow](https://git-rebase.io/). Avoid using `git pull`. Use `git pull --rebase` instead.
- Use the provided [git hooks](./hooks/) to ease the development process.

Expand Down Expand Up @@ -317,11 +317,9 @@ Code guidelines:
- Use a domain-first modules structure.

Example: don't do `constants::logger`. Instead, invert the hierarchy, putting the object for which it is used first: `iroha_logger::constants`.
- Use [`expect`](https://learning-rust.github.io/docs/e4.unwrap_and_expect.html) with an explicit error message or proof of infallibility instead of `unwrap`.
- Use [`expect`](https://learning-rust.github.io/docs/unwrap-and-expect/) with an explicit error message or proof of infallibility instead of `unwrap`.
- Never ignore an error. If you can't `panic` and can't recover, it at least needs to be recorded in the log.
- Prefer to return a `Result` instead of `panic!`.

Exception: when implementing something that uses `issue_send` instead of `send` ([more about actors](docs/source/guides/actor.md)). Actors and parallelism don't mix; you could deadlock the entire peer, so it's better to `panic!` if something goes wrong. This is a necessary concession for asynchronous programming.
- Group related functionality spatially, preferably inside appropriate modules.

For example, instead of having a block with `struct` definitions and then `impl`s for each individual struct, it is better to have the `impl`s related to that `struct` next to it.
Expand Down
14 changes: 14 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ strum = { version = "0.25.0", default-features = false }
getset = "0.1.2"
derive_builder = "0.20"
hex-literal = "0.4.1"
derive-where = "1.2.7"

rand = { version = "0.8.5", default-features = false, features = ["getrandom", "alloc"] }
axum = { version = "0.7.5", default-features = false }
Expand Down
1 change: 0 additions & 1 deletion crates/iroha/examples/tutorial.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! This file contains examples from the Rust tutorial.
//! <https://hyperledger.github.io/iroha-2-docs/guide/rust.html#_2-configuring-iroha-2>
use eyre::{Error, WrapErr};
use iroha::{config::Config, data_model::prelude::Numeric};
Expand Down
15 changes: 6 additions & 9 deletions crates/iroha/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::{collections::HashMap, fmt::Debug};

use eyre::{eyre, Context, Result};
use http::StatusCode;
use iroha_data_model::query::QueryOutputBatchBoxTuple;
use iroha_torii_const::uri as torii_uri;
use parity_scale_codec::{DecodeAll, Encode};
use url::Url;
Expand All @@ -16,9 +17,8 @@ use crate::{
query::{
builder::{QueryBuilder, QueryExecutor},
parameters::ForwardCursor,
predicate::HasPredicateBox,
Query, QueryOutput, QueryOutputBatchBox, QueryRequest, QueryResponse, QueryWithParams,
SingularQuery, SingularQueryBox, SingularQueryOutputBox,
Query, QueryOutput, QueryRequest, QueryResponse, QueryWithParams, SingularQuery,
SingularQueryBox, SingularQueryOutputBox,
},
ValidationFail,
},
Expand Down Expand Up @@ -158,7 +158,7 @@ impl QueryExecutor for Client {
fn start_query(
&self,
query: QueryWithParams,
) -> Result<(QueryOutputBatchBox, u64, Option<Self::Cursor>), Self::Error> {
) -> Result<(QueryOutputBatchBoxTuple, u64, Option<Self::Cursor>), Self::Error> {
let request_head = self.get_query_request_head();

let request = QueryRequest::Start(query);
Expand All @@ -178,7 +178,7 @@ impl QueryExecutor for Client {

fn continue_query(
cursor: Self::Cursor,
) -> Result<(QueryOutputBatchBox, u64, Option<Self::Cursor>), Self::Error> {
) -> Result<(QueryOutputBatchBoxTuple, u64, Option<Self::Cursor>), Self::Error> {
let QueryCursor {
request_head,
cursor,
Expand Down Expand Up @@ -235,10 +235,7 @@ impl Client {
}

/// Build an iterable query and return a builder object
pub fn query<Q>(
&self,
query: Q,
) -> QueryBuilder<Self, Q, <<Q as Query>::Item as HasPredicateBox>::PredicateBoxType>
pub fn query<Q>(&self, query: Q) -> QueryBuilder<Self, Q, Q::Item>
where
Q: Query,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async fn multiple_blocks_created() -> Result<()> {
client
.query(FindAssets::new())
.filter_with(|asset| {
asset.id.account.eq(account_id) & asset.id.definition_id.eq(definition)
asset.id.account.eq(account_id) & asset.id.definition.eq(definition)
})
.execute_all()
})
Expand Down
Loading

0 comments on commit e9d1b1b

Please sign in to comment.