-
Notifications
You must be signed in to change notification settings - Fork 323
evmmax: Poseidon hash amd Falcon primitive nttfw
implementation in EVMMAX [DO NOT MERGE]
#1126
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
Draft
rodiazet
wants to merge
13
commits into
master
Choose a base branch
from
evmmax-poseidon
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1126 +/- ##
===========================================
- Coverage 94.37% 29.78% -64.60%
===========================================
Files 162 165 +3
Lines 17687 18386 +699
===========================================
- Hits 16692 5476 -11216
- Misses 995 12910 +11915
Flags with carried forward coverage won't be shown. Click here to find out more.
|
4bef708
to
ebb6ea9
Compare
ebb6ea9
to
72a0c80
Compare
test: Omit new opcodes with immediate params in unit tests
72a0c80
to
55a677b
Compare
d633143
to
79115fe
Compare
79115fe
to
9fbf9d5
Compare
9fbf9d5
to
459a3e7
Compare
nttfw
implementation in EVMMAX [DO NOT MERGE]
…bit integer for now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements Poseidon hash and Falcon signature primitive
nttfw
using EVMMAX opcodes. This is a PoC PR which is not going to be merged.Depends on: #1120
Poseidon
There are 4 different versions of poseidon hash function implemented basing on Poseidon.sol
19kb
4 683 gas
(Constants initialization cost1 763 gas
)18kb
4 287 gas
(Constants initialization cost1377 gas
)15kb
4 683 gas
(Constants initialization cost1763 gas
)14kb
4 287 gas
(Constants initialization cost1377 gas
)Falcon signature
There is also
nttfw
function implementation in EVMMAX with direct bytecode generation.Total gas usage
5135 Gas
. Bytecode size11 846
. Code is bigger than expected b/c we do not usecallf
and code sections ATM. This will allow code reusing and consequently smaller code size.Important comments:
PUSH
opcodes gas cost to 1 (previously 3). Following the discussion on EMV Gas Repricing WG. This change doesn't influence the total gas cost result so much especially fordatacopy
cases. On the other hand this change significantly decreased constants initialization costs for "via stack" cases.1gas
for one pair addition and2gas
for one pair multiplication.5/100
and6/100
gas average per operation foraddmodx
andmulmodx
accordingly. Benchmark results below.Benchmarks:
Poseidon:
Histograms:
poseidon
poseidon_vec
poseidon_dataload
poseidon_vec_dataload
Falcon
nttfw
with fastmod lib:More benchmarks
addmodx-single
addmodx-vec
mulmodx-single
mulmodx-vec
submodx-single
submodx-single