-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Extend the Math API with EVM precompiles. * feat: Add Math API stubs for ECRecover. (#3921) * test: Add RIPEMD-160 and BLAKE2b to the params estimator. * fix: Improve error output from the params estimator. Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com> * test: Add ECRecover stubs to the params estimator. * fix: Widen ecrecover() parameter type to pass CI checks. * feat(chain): Bump the protocol version. * feat(runtime): Implement ECRecover in the Math API. (#3921) * docs: Document the ecrecover() function. * fix(chain): Guard protocol upgrade behind EVM feature. * add crypto feature gates * fix nightly compile * cargo fmt * fix two ripemd160 missing feature gates * rename crypto_extras feature to protocol_feature equivalents * change repo to our git * put everything under protocol_feature_evm * point to alternative blake2 branch temporarily * Add blake2b f function * add blake2b_f to config * post rebase fixes * wrap all ext_costs in evm feature * add blake_2b_f to runtime estimator * cargo fmt * add new hash algos to feature * add vm-logic test for blake2b_f * fix derive formatting * use same blake2 library * change blake F tests to test 1 round * fix blake f test * cleanup calls_helper * add missing feature gated fields from ExtCostsConfig * add blake2b_f compression docs * remove unused `blake2b_f_byte` as sizes are fixed * add missing blake2b_f to imports * runtime estimator mod docs * Add near-blake2 lib to near-crypto * fix test imports * add more pub methods to blake2 * add blake2 state success tests * cargo fmt * Add initial blake2 logic to vm * Fix ecrecover * Change blake2 `update` to `update_inner` * Update params estimator * Remove duplicate evm feature * Remove pattern * Fix some compilation errors * Fix runtime-params-estimator compile * Fix tests * Reduce blake2s param estimator rounds from 12 to 10 * Add protocol_feature_evm feature to standalone runner * Add estimated gas values * Update estimated gas value note * cargo fmt * Update c2-chacha * Remove nightly features from lib blake2 * Add blake2 pass tests * Fix up ecrecover test * Fix blake2s args * Remove blake2 lib * Update documentation for blake2 * Pin comment for blake2 lib * Fix with_state * Return a bool for ecrecover, not abort * Fix VarBlake2b -> VarBlake2s * Add errors to RPC errors schema * Add bool return to wrapped imports * Take t0 and t1 for blake2b * Charge ripemd160 by blocks, not bytes * Correctly send both t0 and t1 to blake2 * Remove too many rounds error * Remove any near-blake2 errors * Remove hash data overflow error * Rename Blake2InvalidStateLength -> Blake2StateLengthExceeded * Small ecrecover clarifications * Return public key in ecrecover * Correct blake2 message block math * Correct ripemd160 message block math * Read blake2s as u32 not u64 * Remove `state_len` and blake2 len error * Add `saturating_mul` to blake2 math * Don't allocate an extra vec on blake2 * Remove unused import * Fix args in wrapped imports * Fix blake2s test * Remove blake2 and added protocol_feature_evm conditional comps * Remove optional from crypto imports in logic * Revert from near-blake2 to upstream blake2 * Drop libsecp256k1 crate in favour of near-crypto * Improve code quality by using U256 * Pass hash_bytes as ref * Revert "Pass hash_bytes as ref" This reverts commit 434145b. * matklad nit Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com> * Fix ecrecover exports arg sig * Move when malleability check happens * Remove last check in signature values Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com> * Don't use `v` in a check, now unused * Update description of ripemd160 with correct cost * Use u32 for malleability_flag * Introduce protocol_feature_math_extension * Use our own div_ceil implementation * Include protocol_feature_math_extension in runtime-params-estimator/nightly_protocol_features * Nightly protocol version bump * Simplify message_blocks computation * Remove unused div_ceil function * Ignore first byte of result * Remove uneeded return at end of function Co-authored-by: EgorKulikov <egor@egork.net> * Remove check_v and add in option to skip reject upper range * Use `get_vec_from_memory_or_register` over `memory_get_into` * Remove unused * Separate `v`, change args to `u64` * Remove redundant check * 64th byte, not 65 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com> * Fix test * Update doc cost * Fix estimator * Small fixes * Add missing feature `protocol_feature_math_extension` from neard * Add near-primitives to math extension params estimator * Fix byte length * Fix Cargo.toml * Nit. Typos * Nit. param estimator is missing feature dependency * Add feature support for build.sh of test-contract * Add consts for SECP256K1 malleability values * Remove map err, change to unwrap * Change v check to something more simple * Always do signature check * Check one s bound * Allow for specifying a register * Remove math extension feature from primitives core * Nit. Convering byte to bool * Add measuring support. * Revert "Remove math extension feature from primitives core" This reverts commit ac53dcb. * Const SECP256K1 half + 1 * Revert "Add measuring support." This reverts commit 210ee55. * Update gas costs with correct values * Nit. Method signature typo causing runtime failure * Fix fee. It seems like a copy-paste typo * Undo the wrong fix * Add malleability_flag check as requested in #4380 (comment) * syntax fix Co-authored-by: Arto Bendiken <arto@near.org> Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com> Co-authored-by: Michael Birch <michael@near.org> Co-authored-by: Michael Birch <michael.birch@aurora.dev> Co-authored-by: EgorKulikov <egor@egork.net> Co-authored-by: Maksym Zavershynskyi <max@near.org> Co-authored-by: Nikolay Igotti <igotti@gmail.com> Co-authored-by: Bowen Wang <bowenwang1996@users.noreply.github.com> Co-authored-by: Bowen Wang <bowen@near.org>
- Loading branch information
1 parent
951fbfa
commit b0945d6
Showing
30 changed files
with
486 additions
and
55 deletions.
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 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 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 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 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 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 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 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 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 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 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 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 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 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.