Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Komodo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dragoon
Komodo
Commits
7bf2aa40
Verified
Commit
7bf2aa40
authored
7 months ago
by
STEVAN Antoine
Browse files
Options
Downloads
Patches
Plain Diff
refactor example
parent
c7f6af78
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/fri.rs
+17
-9
17 additions, 9 deletions
examples/fri.rs
with
17 additions
and
9 deletions
examples/fri.rs
+
17
−
9
View file @
7bf2aa40
...
@@ -8,24 +8,32 @@ use rs_merkle::Hasher;
...
@@ -8,24 +8,32 @@ use rs_merkle::Hasher;
use
fri
::
algorithms
::
Blake3
;
use
fri
::
algorithms
::
Blake3
;
use
komodo
::
error
::
KomodoError
;
use
komodo
::
error
::
KomodoError
;
fn
run
<
F
:
PrimeField
,
H
:
Hasher
,
P
>
()
->
Result
<
(),
KomodoError
>
fn
run
<
const
N
:
usize
,
F
:
PrimeField
,
H
:
Hasher
,
P
>
(
bytes
:
&
[
u8
],
k
:
usize
,
n
:
usize
,
bf
:
usize
,
rpo
:
usize
,
q
:
usize
,
)
->
Result
<
(),
KomodoError
>
where
where
P
:
DenseUVPolynomial
<
F
>
,
P
:
DenseUVPolynomial
<
F
>
,
for
<
'a
,
'b
>
&
'a
P
:
Div
<&
'b
P
,
Output
=
P
>
,
for
<
'a
,
'b
>
&
'a
P
:
Div
<&
'b
P
,
Output
=
P
>
,
<
H
as
rs_merkle
::
Hasher
>
::
Hash
:
AsRef
<
[
u8
]
>
,
<
H
as
rs_merkle
::
Hasher
>
::
Hash
:
AsRef
<
[
u8
]
>
,
{
{
// the code parameters and the data to manipulate
let
(
k
,
n
)
=
(
4
,
16
);
let
bytes
=
include_bytes!
(
"../assets/dragoon_133x133.png"
)
.to_vec
();
eprintln!
(
"loaded {} bytes of data"
,
bytes
.len
());
let
shards
=
komodo
::
fri
::
encode
::
<
F
>
(
&
bytes
,
k
,
n
);
let
shards
=
komodo
::
fri
::
encode
::
<
F
>
(
&
bytes
,
k
,
n
);
let
blocks
=
komodo
::
fri
::
prove
::
<
2
,
F
,
H
,
P
>
(
shards
,
1
,
1
,
50
)
.unwrap
();
let
blocks
=
komodo
::
fri
::
prove
::
<
N
,
F
,
H
,
P
>
(
shards
,
bf
,
rpo
,
q
)
.unwrap
();
komodo
::
fri
::
verify
::
<
2
,
F
,
H
,
P
>
(
blocks
[
0
]
.clone
(),
n
,
50
)
.unwrap
();
for
block
in
blocks
{
komodo
::
fri
::
verify
::
<
N
,
F
,
H
,
P
>
(
block
,
n
,
q
)
.unwrap
();
}
Ok
(())
Ok
(())
}
}
fn
main
()
{
fn
main
()
{
run
::
<
Fr
,
Blake3
,
DensePolynomial
<
Fr
>>
()
.unwrap
();
let
bytes
=
include_bytes!
(
"../assets/dragoon_133x133.png"
)
.to_vec
();
eprintln!
(
"loaded {} bytes of data"
,
bytes
.len
());
run
::
<
2
,
Fr
,
Blake3
,
DensePolynomial
<
Fr
>>
(
&
bytes
,
4
,
16
,
1
,
1
,
50
)
.unwrap
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment