Andrew Ashikhmin
b38e17e393
Implement PIP-33: Napoli Hardfork ( #8975 )
...
Initial support of the upcoming Napoli hard fork on Polygon – see
[PIP-33](https://forum.polygon.technology/t/pip-33-napoli-upgrade ). Per
[PIP-31](https://github.com/maticnetwork/Polygon-Improvement-Proposals/blob/main/PIPs/PIP-31.md ),
it parallels the
[Cancun](https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/cancun.md )
upgrade of Ethereum, but does not include
[EIP-4788](https://eips.ethereum.org/EIPS/eip-4788 ),
[EIP-4844](https://eips.ethereum.org/EIPS/eip-4844 ),
[EIP-7516](https://eips.ethereum.org/EIPS/eip-7516 ). In other words,
Napoli includes [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153 ),
[EIP-5656](https://eips.ethereum.org/EIPS/eip-5656 ),
[EIP-6780](https://eips.ethereum.org/EIPS/eip-6780 ) from Cancun.
This PR implements
[PIP-31](https://github.com/maticnetwork/Polygon-Improvement-Proposals/blob/main/PIPs/PIP-31.md ),
[PIP-16: Transaction Dependency
Data](https://github.com/maticnetwork/Polygon-Improvement-Proposals/blob/main/PIPs/PIP-16.md )
(by merging `ParallelUniverseBlock` into `NapoliBlock`; the bulk of
PIP-16 was implemented in PR #8037 ), and [PIP-27: Precompiled for
secp256r1 Curve
Support](https://github.com/maticnetwork/Polygon-Improvement-Proposals/blob/main/PIPs/PIP-27.md )
([EIP-7212](https://eips.ethereum.org/EIPS/eip-7212 ); see also
https://github.com/maticnetwork/bor/pull/1069 &
https://github.com/ethereum/go-ethereum/pull/27540 ).
---------
Co-authored-by: Anshal Shukla <shukla.anshal85@gmail.com>
2024-01-17 14:13:16 +01:00
Andrew Ashikhmin
f492d88178
Switch to official KZG ceremony trusted setup (EIP-4844) ( #8531 )
...
See https://github.com/ethereum/consensus-specs/pull/3521 &
https://github.com/crate-crypto/go-kzg-4844/pull/61 . This is required
for
[dencun-devnet-10](https://notes.ethereum.org/@ethpandaops/dencun-devnet-10 ).
2023-10-19 18:33:05 +02:00
Andrew Ashikhmin
4a74ee2589
EIP-4844: switch precompile input's z and y to big endian ( #7680 )
...
according to https://github.com/ethereum/EIPs/pull/7020 . Prerequisite:
https://github.com/ledgerwatch/erigon-lib/pull/1015 .
2023-06-07 17:33:15 +02:00
Martin Holst Swende
6fb6cbf27c
core/vm, protocol_params: implement eip-2565 modexp repricing ( #21607 )
...
* core/vm, protocol_params: implement eip-2565 modexp repricing
* core/vm: fix review concerns
2021-03-08 11:44:39 +01:00
Martin Holst Swende
e9b1492b0f
core/vm: fix benchmark overflow + prep for precompile repricings ( #21530 )
...
* core/vm/testdata: add gascost expectations to testcases
* core/vm: verify expected gas in tests for precompiles
* core/vm: fix overflow flaw in gas/s calculation
2020-10-06 14:12:09 +02:00
kilic
0921861edb
core/vm, crypto/bls12381, params: add bls12-381 elliptic curve precompiles ( #21018 )
...
* crypto: add bls12-381 elliptic curve wrapper
* params: add bls12-381 precompile gas parameters
* core/vm: add bls12-381 precompiles
* core/vm: add bls12-381 precompile tests
* go.mod, go.sum: use latest bls12381 lib
* core/vm: move point encode/decode functions to base library
* crypto/bls12381: introduce bls12-381 library init function
* crypto/bls12381: import bls12381 elliptic curve implementation
* go.mod, go.sum: remove bls12-381 library
* remove unsued frobenious coeffs
supress warning for inp that used in asm
* add mappings tests for zero inputs
fix swu g2 minus z inverse constant
* crypto/bls12381: fix typo
* crypto/bls12381: better comments for bls12381 constants
* crypto/bls12381: swu, use single conditional for e2
* crypto/bls12381: utils, delete empty line
* crypto/bls12381: utils, use FromHex for string to big
* crypto/bls12381: g1, g2, strict length check for FromBytes
* crypto/bls12381: field_element, comparision changes
* crypto/bls12381: change swu, isogeny constants with hex values
* core/vm: fix point multiplication comments
* core/vm: fix multiexp gas calculation and lookup for g1 and g2
* core/vm: simpler imput length check for multiexp and pairing precompiles
* core/vm: rm empty multiexp result declarations
* crypto/bls12381: remove modulus type definition
* crypto/bls12381: use proper init function
* crypto/bls12381: get rid of new lines at fatal desciprtions
* crypto/bls12-381: fix no-adx assembly multiplication
* crypto/bls12-381: remove old config function
* crypto/bls12381: update multiplication backend
this commit changes mul backend to 6limb eip1962 backend
mul assign operations are dropped
* core/vm/contracts_tests: externalize test vectors for precompiles
* core/vm/contracts_test: externalize failure-cases for precompiles
* core/vm: linting
* go.mod: tiny up sum file
* core/vm: fix goimports linter issues
* crypto/bls12381: build tags for plain ASM or ADX implementation
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
# Conflicts:
# core/vm/contracts.go
# core/vm/contracts_test.go
# go.sum
2020-06-15 19:38:13 +03:00
Martin Holst Swende
36b78abe61
core/vm: instruction tests ( #16327 )
...
This PR makes it easy to generate and execute testcases for VM arithmetic operations. By enabling and running the testcase TestWriteExpectedValues, a set of json files are created which contain input and output for each arith operation.
The test TestJsonTestcases executes all of those tests.
While meaningless as is, this PR makes it less risky to make changes (optimizations) to the vm operations, since there will be a larger body of testcases.
2019-04-04 11:19:38 +02:00