-
Notifications
You must be signed in to change notification settings - Fork 775
Math API ecrecover and ripemd160 extension
#4380
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
Merged
bowenwang1996
merged 163 commits into
near:master
from
joshuajbouw:feat/evm/math-extension
Jun 30, 2021
Merged
Changes from all commits
Commits
Show all changes
163 commits
Select commit
Hold shift + click to select a range
4101d54
feat: Extend the Math API with EVM precompiles.
artob f1129da
feat: Add Math API stubs for ECRecover. (#3921)
artob 55291ee
test: Add RIPEMD-160 and BLAKE2b to the params estimator.
artob e4aedd6
fix: Improve error output from the params estimator.
artob 4b145d1
test: Add ECRecover stubs to the params estimator.
artob f8461f7
fix: Widen ecrecover() parameter type to pass CI checks.
artob becf003
feat(chain): Bump the protocol version.
artob 4950ad3
feat(runtime): Implement ECRecover in the Math API. (#3921)
artob a5bbe0b
docs: Document the ecrecover() function.
artob 2f88193
fix(chain): Guard protocol upgrade behind EVM feature.
artob e97e6c6
add crypto feature gates
joshuajbouw acb1440
fix nightly compile
joshuajbouw 773d818
cargo fmt
joshuajbouw bdc0495
fix two ripemd160 missing feature gates
joshuajbouw b55fa0f
rename crypto_extras feature to protocol_feature equivalents
joshuajbouw e6c389f
change repo to our git
joshuajbouw fd0022a
put everything under protocol_feature_evm
joshuajbouw c1d77f0
point to alternative blake2 branch temporarily
joshuajbouw f7ec5b1
Add blake2b f function
joshuajbouw 598b0c5
add blake2b_f to config
joshuajbouw 16a32c8
post rebase fixes
joshuajbouw e2b5e59
wrap all ext_costs in evm feature
joshuajbouw ca3e329
add blake_2b_f to runtime estimator
joshuajbouw 188b9b8
cargo fmt
joshuajbouw b0236f5
add new hash algos to feature
joshuajbouw 8945af7
add vm-logic test for blake2b_f
joshuajbouw 78ec861
fix derive formatting
joshuajbouw 075e6be
use same blake2 library
joshuajbouw d53a580
change blake F tests to test 1 round
joshuajbouw 8da8c49
fix blake f test
joshuajbouw 9f3358c
cleanup calls_helper
joshuajbouw 5ac0d32
add missing feature gated fields from ExtCostsConfig
joshuajbouw 1c9ba91
add blake2b_f compression docs
joshuajbouw 6872025
remove unused `blake2b_f_byte` as sizes are fixed
joshuajbouw 6704cad
add missing blake2b_f to imports
joshuajbouw 36bbc37
runtime estimator mod docs
joshuajbouw e971fe3
Add near-blake2 lib to near-crypto
joshuajbouw 10f356f
fix test imports
joshuajbouw 0fca391
add more pub methods to blake2
joshuajbouw 83a1d11
add blake2 state success tests
joshuajbouw bdc0904
cargo fmt
joshuajbouw 7dbcfdb
Add initial blake2 logic to vm
joshuajbouw ee2d0f6
Fix ecrecover
birchmd ebf64bc
Change blake2 `update` to `update_inner`
joshuajbouw bffa864
Update params estimator
joshuajbouw bce76f3
Remove duplicate evm feature
joshuajbouw 6b5d85c
Merge branch 'master' into evm-math-api
joshuajbouw ac9982d
Remove pattern
joshuajbouw 55dda77
Fix some compilation errors
birchmd 77f1b2a
Fix runtime-params-estimator compile
birchmd d461c3b
Fix tests
joshuajbouw 6207f4b
Reduce blake2s param estimator rounds from 12 to 10
joshuajbouw 3b4c098
Add protocol_feature_evm feature to standalone runner
joshuajbouw 6851665
Merge branch 'master' into evm-math-api
joshuajbouw 355b997
Merge branch 'master' into evm-math-api
joshuajbouw 9d84a33
Add estimated gas values
joshuajbouw 6a57744
Merge remote-tracking branch 'upstream/evm-math-api' into evm-math-api
joshuajbouw e0cddbb
Update estimated gas value note
joshuajbouw 15e9ecc
cargo fmt
joshuajbouw 6c21c78
Update c2-chacha
joshuajbouw 4483cd4
Remove nightly features from lib blake2
joshuajbouw 4a1c26e
Add blake2 pass tests
joshuajbouw bcc7dd2
Fix up ecrecover test
joshuajbouw 2f7cd2f
Fix blake2s args
joshuajbouw 1dc1090
Merge branch 'master' into evm-math-api
joshuajbouw 9a9fd8a
Merge remote-tracking branch 'upstream/master' into evm-math-api
joshuajbouw 844da2e
Remove blake2 lib
joshuajbouw 9f13b1e
Update documentation for blake2
joshuajbouw 76e2a2e
Pin comment for blake2 lib
joshuajbouw ec72a48
Fix with_state
joshuajbouw 276523e
Merge remote-tracking branch 'upstream/master' into evm-math-api
joshuajbouw e395b1c
Return a bool for ecrecover, not abort
joshuajbouw fe76336
Fix VarBlake2b -> VarBlake2s
joshuajbouw bda2e42
Add errors to RPC errors schema
joshuajbouw cf61d15
Add bool return to wrapped imports
joshuajbouw b61e89d
Merge remote-tracking branch 'upstream/master' into evm-math-api
joshuajbouw c59b121
Merge branch 'master' into evm-math-api
joshuajbouw 23cd417
Take t0 and t1 for blake2b
joshuajbouw 48fb8dd
Charge ripemd160 by blocks, not bytes
joshuajbouw f985379
Correctly send both t0 and t1 to blake2
joshuajbouw 93240c6
Remove too many rounds error
joshuajbouw 764f4a1
Remove any near-blake2 errors
joshuajbouw 8be6dac
Remove hash data overflow error
joshuajbouw b58d765
Rename Blake2InvalidStateLength -> Blake2StateLengthExceeded
joshuajbouw 1410e6d
Small ecrecover clarifications
joshuajbouw 0210eab
Return public key in ecrecover
joshuajbouw 4f82dc9
Correct blake2 message block math
joshuajbouw c79cd20
Correct ripemd160 message block math
joshuajbouw 98ae102
Read blake2s as u32 not u64
joshuajbouw 6db1324
Remove `state_len` and blake2 len error
joshuajbouw ed8b9c8
Add `saturating_mul` to blake2 math
joshuajbouw fa448b1
Don't allocate an extra vec on blake2
joshuajbouw 72273d2
Merge branch 'master' into evm-math-api
joshuajbouw 60a426b
Remove unused import
joshuajbouw c1eba41
Fix args in wrapped imports
joshuajbouw 881aaee
Fix blake2s test
joshuajbouw db7f3aa
Merge branch 'evm-math-api' into feat/evm/math-extension
joshuajbouw 08d50cb
Remove blake2 and added protocol_feature_evm conditional comps
joshuajbouw 2d1ae30
Remove optional from crypto imports in logic
joshuajbouw 951e767
Revert from near-blake2 to upstream blake2
joshuajbouw 9a3f924
Drop libsecp256k1 crate in favour of near-crypto
joshuajbouw 7f3114b
Improve code quality by using U256
joshuajbouw 434145b
Pass hash_bytes as ref
joshuajbouw 9c28150
Revert "Pass hash_bytes as ref"
joshuajbouw 7f1c296
matklad nit
joshuajbouw 8c9341f
Fix ecrecover exports arg sig
joshuajbouw 0acaa67
Move when malleability check happens
joshuajbouw 8bb840b
Remove last check in signature values
joshuajbouw bea8361
Don't use `v` in a check, now unused
joshuajbouw 211db82
Update description of ripemd160 with correct cost
joshuajbouw f6d566a
Use u32 for malleability_flag
birchmd 3f08a35
Introduce protocol_feature_math_extension
birchmd 4ceab99
Use our own div_ceil implementation
birchmd 884d714
Include protocol_feature_math_extension in runtime-params-estimator/n…
birchmd 402fa8f
Nightly protocol version bump
birchmd b778a93
Merge branch 'master' into feat/evm/math-extension
birchmd aa1b8c5
Simplify message_blocks computation
birchmd 1ec6416
Remove unused div_ceil function
birchmd b572bdc
Ignore first byte of result
joshuajbouw a7ee788
Remove uneeded return at end of function
joshuajbouw 1f2a314
Remove check_v and add in option to skip reject upper range
joshuajbouw 1405c91
Use `get_vec_from_memory_or_register` over `memory_get_into`
joshuajbouw 8c3de8a
Remove unused
joshuajbouw 3c4144b
Separate `v`, change args to `u64`
joshuajbouw 395ad53
Remove redundant check
joshuajbouw b0d02f5
Merge branch 'master' into feat/evm/math-extension
joshuajbouw 20252a1
64th byte, not 65
joshuajbouw 2e4742e
Fix test
joshuajbouw 88fd6aa
Update doc cost
joshuajbouw 9d58f32
Fix estimator
joshuajbouw 2fe75e8
Small fixes
joshuajbouw fe31431
Add missing feature `protocol_feature_math_extension` from neard
joshuajbouw d937efb
Merge branch 'master' into feat/evm/math-extension
joshuajbouw 7ca7285
Add near-primitives to math extension params estimator
joshuajbouw d9684df
Fix byte length
joshuajbouw 1211d9c
Fix Cargo.toml
5c722b2
Nit. Typos
b17bddb
Nit. param estimator is missing feature dependency
4710683
Add feature support for build.sh of test-contract
7b06eb7
Merge branch 'master' into feat/evm/math-extension
joshuajbouw 585a973
Merge branch 'master' into feat/evm/math-extension
joshuajbouw e5f7468
Add consts for SECP256K1 malleability values
joshuajbouw e6d926b
Merge remote-tracking branch 'origin/feat/evm/math-extension' into fe…
joshuajbouw 2091bfa
Remove map err, change to unwrap
joshuajbouw bdc9066
Change v check to something more simple
joshuajbouw 5e76c8b
Always do signature check
joshuajbouw ca62541
Merge remote-tracking branch 'upstream/master' into feat/evm/math-ext…
joshuajbouw 38fc362
Check one s bound
joshuajbouw 43aa88b
Allow for specifying a register
joshuajbouw ac53dcb
Remove math extension feature from primitives core
joshuajbouw 2c4a48b
Nit. Convering byte to bool
210ee55
Add measuring support.
olonho f25fe99
Revert "Remove math extension feature from primitives core"
joshuajbouw 429f18b
Const SECP256K1 half + 1
joshuajbouw 3f449d5
Merge remote-tracking branch 'upstream/master' into feat/evm/math-ext…
joshuajbouw a7868e8
Revert "Add measuring support."
joshuajbouw 23f91e8
Update gas costs with correct values
joshuajbouw 77e25de
Nit. Method signature typo causing runtime failure
037289f
Fix fee. It seems like a copy-paste typo
d09099e
Undo the wrong fix
73380e1
Add malleability_flag check as requested in https://github.com/near/n…
07ca301
Merge branch 'master' into feat/evm/math-extension
bowenwang1996 14b9869
syntax fix
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Empty file.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.