Commit graph

48 commits

Author SHA1 Message Date
Daniel Liu
934c8d0679
perf(all): use big.Int.Sign() to compare with 0 (#1969) 2026-02-05 11:45:44 +05:30
Daniel Liu
2826b1e9c0
crypto/bn256: switch to gnark again #32659 (#1552)
We recently update our default implementation to gnark in
https://github.com/ethereum/go-ethereum/pull/32024
Then we found a consensus issue and reverted it in
65d77c5129
We fixed the consensus issue and have been fuzzing it more since then in
https://github.com/ethereum/go-ethereum/pull/32055/files
https://github.com/ethereum/go-ethereum/pull/32065
https://github.com/ethereum/go-ethereum/pull/32055/files

So I think now is the time to update it back to gnark

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2025-09-24 07:48:52 +08:00
wit765
e4fd044fa0
crypto: fix unknown linters (#1488)
Co-authored-by: wit <wit765765346@gmail>
2025-09-12 14:45:26 +08:00
Daniel Liu
c7f17cb300
crypto/bn256: refactor to use bitutil.TestBytes #32435 (#1436)
Co-authored-by: cui <cuiweixie@gmail.com>
2025-09-06 17:15:07 +08:00
Daniel Liu
6b31dedf03
crypto/bn256/gnark: align marshaling behavior #32065 (#1231)
Aligns the marshaling behavior of gnark to google and cloudflare

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: kevaundray <kevtheappdev@gmail.com>
2025-08-20 15:09:36 +08:00
Daniel Liu
9f360824a9
crypto/bn256: add documentation on subgroup checks for G2 #32066 (#1232)
This PR improves the IsOnCurve methods for BN254 G2 points by:

* Clarifying its behavior the docstring, making it explicit that it
verifies both the point being on the curve and in the correct subgroup.

* Adding an in-line comment explaining the subgroup membership check
(c.Mul(Order)).

 * Minor wording adjustments for readability and consistency.

Co-authored-by: Antonio Sanso <antonio.sanso@gmail.com>
2025-07-26 17:41:09 +08:00
Daniel Liu
f5ad8091e2
crypto/bn256/cloudflare: pull in upstream fix for R27 and R29 usage #32057 (#1229)
Pulls in https://github.com/cloudflare/bn256/pull/48 to remove usage of
R27 and R29 [which are reserved](https://go.dev/doc/asm#arm64).

Co-authored-by: Stephen Buttolph <stephen@avalabs.org>
2025-07-26 17:39:28 +08:00
Daniel Liu
0fd51f13a1
tests/fuzzers: added bn marshaling fuzzers #32053 (#1228)
Adds marshaling fuzzing for G1 and G2 to oss-fuzz.

Also aligns the behavior of the google library to that of gnark and
cloudflare, which only ever read the first 64 / 128 bytes of the input,
regardless of how long the input is

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2025-07-26 17:36:58 +08:00
Daniel Liu
f30a126380
crypto/bn256: fix gnark deserialisation #32055 (#1227)
fixes the gnark deserialisation

---------

Co-authored-by: kevaundray <kevtheappdev@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-07-26 17:35:13 +08:00
Daniel Liu
f7c46d0ad7 crypto: fix some typos in comments and names (#31023) 2025-03-19 18:02:46 +08:00
gitglorythegreat
9ca3d10001 crypto/bn256: fix MulScalar (#30974)
The `a` parameter should be used in the `MulScalar` function. The
upstream cloudflare and google repos have already merged fixes.

Reference:
*
8d7daa0c54
* https://github.com/cloudflare/bn256/pull/33
2025-01-04 11:00:57 +08:00
kevaundray
e581093ce1 crypto, tests/fuzzers: add gnark bn254 precompile methods for fuzzing (#30585)
Makes the gnark precompile methods more amenable to fuzzing
2025-01-04 11:00:57 +08:00
George Ma
136e87fa4c crypto: fix docstrings and comments 2025-01-04 11:00:57 +08:00
Daniel Liu
fabfcc7f6c crypto: fix docstring names (#28923) 2024-12-09 17:49:00 +08:00
Daniel Liu
146bc2be7b crypto: add go:build lines (#23468) 2024-12-09 17:49:00 +08:00
Daniel Liu
a64e42463a crypto/bn256: refine comments according to #19577, #21595, and #21836 (#21847) 2024-12-09 17:49:00 +08:00
Daniel Liu
a2eb8553e8 crypto/bn256: better comments for u, P and Order (#21836) 2024-12-09 17:49:00 +08:00
Daniel Liu
b2be754647 crypto/bn256: fix import line (#20723) 2024-12-09 17:48:59 +08:00
Daniel Liu
6033722b72 crypto: use golangci-lint (#20295) 2024-12-09 17:48:59 +08:00
Daniel Liu
66dd846d46 crypto/bn256/cloudflare: fix comments to describe the updated curve parameters (#19577)
* Removed comment section referring to Cloudflare's bn curve parameters

* Added comment to clarify the nature of the parameters

* Changed value of xi to i+9
2024-12-09 17:48:59 +08:00
Daniel Liu
95f8abb765 crypto/bn256: fix staticcheck warning SA9009: ineffectual compiler directive 2024-10-30 21:10:45 +08:00
Daniel Liu
c6e4e880ea all: fix staticcheck warning SA4006: never used value 2024-10-24 17:37:19 +08:00
Daniel Liu
4f9501f12c common, crypto: move fuzzers out of core (#22029) 2024-09-22 19:25:37 +08:00
uji
d4b98063e8 crypto/bn256/cloudflare: fix asm for dynamic linking (#24476)
When using -buildmode=shared, R15 is clobbered by a global variable
access; use a different register instead.

Fixes: #24439
2024-01-18 21:59:02 +08:00
Guillaume Ballet
af8c4d4e85 crypto/cloudflare/bn256: fix in-place addition and unmarshalling (#23419) 2024-01-18 21:58:12 +08:00
Martin Holst Swende
3a6e26b844 crypto/bn256: improve bn256 fuzzer (#21815)
* crypto/cloudflare: fix nil deref in random G1/G2 reading

* crypto/bn256: improve fuzzer

* crypto/bn256: fix some flaws in fuzzer
2024-01-18 21:57:31 +08:00
Antoine Rondelet
c48e9873f3 crypto/bn256/cloudflare: checks for nil pointers in Marshal functions (#19609)
* Added checks for nil pointers in Marshal functions

* Set nil pointer to identity in GT before marshaling
2024-01-18 21:57:04 +08:00
Wanwiset Peerapatanapokin
060d9ce26f
mac arm build fix ref: https://github.com/cloudflare/bn256/pull/4 (#278)
Co-authored-by: Wanwiset Peerapatanapokin <wanwiset25@gmail.com>
2023-06-12 23:46:55 +10:00
olumuyiwadad
b5abbfed79 new EVM Upgrade
- Solidity Upgraded up to v0.8.0
-  Fixed and Added eth_chainId
- Fix error in TransactionRecipet
- Reward halving issue fixed
2021-09-21 16:53:46 +05:30
olumuyiwadad
571c41f891 FIx Bad block error. 2021-09-17 17:59:06 +05:30
Jianrong
0fdab2027c add linting as the first CI task 2021-08-07 14:27:08 +10:00
dev-vadim
dbe8c9d984 upgrade XDC.Network with v1.8.27. 2020-12-23 16:32:06 +05:30
diglspacedavid
474cc37036 upgrade codebase with ethereum:v1.8.13 2020-11-23 13:40:30 +05:30
AnilChinchawale
a638d2adc0 Minor error fixed. 2019-03-16 16:02:10 +05:30
AnilChinchawale
153c8ef49d File Updated | transaction & constants 2019-03-14 15:58:42 +05:30
AnilChinchawale
29cb1de084 backend added with latest code 2019-01-28 04:50:18 +05:30
AnilChinchawale
e3bd171e0d lib added for cloudflare 2019-01-19 04:41:44 +05:30
AnilChinchawale
58141d1edb Added latest crypto_google 2019-01-19 04:41:18 +05:30
parmarrushabh
dd0f27ebeb add go1.11, remove go1.9 2018-11-06 12:33:45 +05:30
Péter Szilágyi
a6d45a5d00
crypto/bn256: add missing license file, release wrapper in BSD-3 2018-08-20 18:05:06 +03:00
Péter Szilágyi
3e21adc648
crypto/bn256: fix issues caused by Go 1.11 2018-08-16 11:02:16 +03:00
thomasmodeneis
ba1030b6b8 build: enable goimports and varcheck linters (#16446) 2018-04-18 00:53:50 +02:00
Péter Szilágyi
1203c6a237
crypto/bn256: full switchover to cloudflare's code (#16301)
* crypto/bn256: full switchover to cloudflare's code

* crypto/bn256: only use cloudflare for optimized architectures

* crypto/bn256: upstream fallback for non-optimized code

* .travis, build: drop support for Go 1.8 (need type aliases)

* crypto/bn256/cloudflare: enable curve mul lattice optimization
2018-03-20 01:13:54 +09:00
Péter Szilágyi
bd6879ac51
core/vm, crypto/bn256: switch over to cloudflare library (#16203)
* core/vm, crypto/bn256: switch over to cloudflare library

* crypto/bn256: unmarshal constraint + start pure go impl

* crypto/bn256: combo cloudflare and google lib

* travis: drop 386 test job
2018-03-05 14:33:45 +02:00
Matthew Di Ferrante
80c6dfc19f crypto/bn256: fix generator on G1 (#15591)
Generator in the current lib uses -2 as the y point when doing
ScalarBaseMult, this makes it so that points/signatures generated
from libs like py_ecc don't match/validate as pretty much all
other libs (including libsnark) have (1, 2) as the standard
generator.

This does not affect consensus as the generator is never used in
the VM, points are always explicitly defined and there is not
ScalarBaseMult op - it only makes it so that doing "import
github.com/ethereum/go-ethereum/crypto/bn256" doesn't generate
bad points in userland tools.
2017-12-01 13:03:39 +01:00
Péter Szilágyi
1335a6cc8c
core/vm, crypto/bn256: fix bn256 use and pairing corner case 2017-08-17 16:46:46 +03:00
Felix Lange
069cb661c3 crypto/bn256: fix go vet false positive
Also add the package to the license tool ignore list.
2017-05-24 15:40:26 +02:00
Jeffrey Wilcke
10a57fc3d4 consensus, core/*, params: metropolis preparation refactor
This commit is a preparation for the upcoming metropolis hardfork. It
prepares the state, core and vm packages such that integration with
metropolis becomes less of a hassle.

* Difficulty calculation requires header instead of individual
  parameters
* statedb.StartRecord renamed to statedb.Prepare and added Finalise
  method required by metropolis, which removes unwanted accounts from
  the state (i.e. selfdestruct)
* State keeps record of destructed objects (in addition to dirty
  objects)
* core/vm pre-compiles may now return errors
* core/vm pre-compiles gas check now take the full byte slice as argument
  instead of just the size
* core/vm now keeps several hard-fork instruction tables instead of a
  single instruction table and removes the need for hard-fork checks in
  the instructions
* core/vm contains a empty restruction function which is added in
  preparation of metropolis write-only mode operations
* Adds the bn256 curve
* Adds and sets the metropolis chain config block parameters (2^64-1)
2017-05-18 09:05:58 +02:00