Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
e13fa32c
Unverified
Commit
e13fa32c
authored
1 year ago
by
Martin Holst Swende
Committed by
GitHub
1 year ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/vm: update 4844 - point evaluation precompile address (#27874)
parent
0d772b9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
49 deletions
+51
-49
contracts.go
core/vm/contracts.go
+10
-10
contracts_test.go
core/vm/contracts_test.go
+41
-39
No files found.
core/vm/contracts.go
View file @
e13fa32c
...
...
@@ -95,16 +95,16 @@ var PrecompiledContractsBerlin = map[common.Address]PrecompiledContract{
// PrecompiledContractsCancun contains the default set of pre-compiled Ethereum
// contracts used in the Cancun release.
var
PrecompiledContractsCancun
=
map
[
common
.
Address
]
PrecompiledContract
{
common
.
BytesToAddress
([]
byte
{
1
})
:
&
ecrecover
{},
common
.
BytesToAddress
([]
byte
{
2
})
:
&
sha256hash
{},
common
.
BytesToAddress
([]
byte
{
3
})
:
&
ripemd160hash
{},
common
.
BytesToAddress
([]
byte
{
4
})
:
&
dataCopy
{},
common
.
BytesToAddress
([]
byte
{
5
})
:
&
bigModExp
{
eip2565
:
true
},
common
.
BytesToAddress
([]
byte
{
6
})
:
&
bn256AddIstanbul
{},
common
.
BytesToAddress
([]
byte
{
7
})
:
&
bn256ScalarMulIstanbul
{},
common
.
BytesToAddress
([]
byte
{
8
})
:
&
bn256PairingIstanbul
{},
common
.
BytesToAddress
([]
byte
{
9
})
:
&
blake2F
{},
common
.
BytesToAddress
([]
byte
{
20
})
:
&
kzgPointEvaluation
{},
common
.
BytesToAddress
([]
byte
{
1
})
:
&
ecrecover
{},
common
.
BytesToAddress
([]
byte
{
2
})
:
&
sha256hash
{},
common
.
BytesToAddress
([]
byte
{
3
})
:
&
ripemd160hash
{},
common
.
BytesToAddress
([]
byte
{
4
})
:
&
dataCopy
{},
common
.
BytesToAddress
([]
byte
{
5
})
:
&
bigModExp
{
eip2565
:
true
},
common
.
BytesToAddress
([]
byte
{
6
})
:
&
bn256AddIstanbul
{},
common
.
BytesToAddress
([]
byte
{
7
})
:
&
bn256ScalarMulIstanbul
{},
common
.
BytesToAddress
([]
byte
{
8
})
:
&
bn256PairingIstanbul
{},
common
.
BytesToAddress
([]
byte
{
9
})
:
&
blake2F
{},
common
.
BytesToAddress
([]
byte
{
0x0a
})
:
&
kzgPointEvaluation
{},
}
// PrecompiledContractsBLS contains the set of pre-compiled Ethereum
...
...
This diff is collapsed.
Click to expand it.
core/vm/contracts_test.go
View file @
e13fa32c
...
...
@@ -56,16 +56,17 @@ var allPrecompiles = map[common.Address]PrecompiledContract{
common
.
BytesToAddress
([]
byte
{
7
})
:
&
bn256ScalarMulIstanbul
{},
common
.
BytesToAddress
([]
byte
{
8
})
:
&
bn256PairingIstanbul
{},
common
.
BytesToAddress
([]
byte
{
9
})
:
&
blake2F
{},
common
.
BytesToAddress
([]
byte
{
10
})
:
&
bls12381G1Add
{},
common
.
BytesToAddress
([]
byte
{
11
})
:
&
bls12381G1Mul
{},
common
.
BytesToAddress
([]
byte
{
12
})
:
&
bls12381G1MultiExp
{},
common
.
BytesToAddress
([]
byte
{
13
})
:
&
bls12381G2Add
{},
common
.
BytesToAddress
([]
byte
{
14
})
:
&
bls12381G2Mul
{},
common
.
BytesToAddress
([]
byte
{
15
})
:
&
bls12381G2MultiExp
{},
common
.
BytesToAddress
([]
byte
{
16
})
:
&
bls12381Pairing
{},
common
.
BytesToAddress
([]
byte
{
17
})
:
&
bls12381MapG1
{},
common
.
BytesToAddress
([]
byte
{
18
})
:
&
bls12381MapG2
{},
common
.
BytesToAddress
([]
byte
{
20
})
:
&
kzgPointEvaluation
{},
common
.
BytesToAddress
([]
byte
{
0x0a
})
:
&
kzgPointEvaluation
{},
common
.
BytesToAddress
([]
byte
{
0x0f
,
0x0a
})
:
&
bls12381G1Add
{},
common
.
BytesToAddress
([]
byte
{
0x0f
,
0x0b
})
:
&
bls12381G1Mul
{},
common
.
BytesToAddress
([]
byte
{
0x0f
,
0x0c
})
:
&
bls12381G1MultiExp
{},
common
.
BytesToAddress
([]
byte
{
0x0f
,
0x0d
})
:
&
bls12381G2Add
{},
common
.
BytesToAddress
([]
byte
{
0x0f
,
0x0e
})
:
&
bls12381G2Mul
{},
common
.
BytesToAddress
([]
byte
{
0x0f
,
0x0f
})
:
&
bls12381G2MultiExp
{},
common
.
BytesToAddress
([]
byte
{
0x0f
,
0x10
})
:
&
bls12381Pairing
{},
common
.
BytesToAddress
([]
byte
{
0x0f
,
0x11
})
:
&
bls12381MapG1
{},
common
.
BytesToAddress
([]
byte
{
0x0f
,
0x12
})
:
&
bls12381MapG2
{},
}
// EIP-152 test vectors
...
...
@@ -303,37 +304,38 @@ func benchJson(name, addr string, b *testing.B) {
}
}
func
TestPrecompiledBLS12381G1Add
(
t
*
testing
.
T
)
{
testJson
(
"blsG1Add"
,
"0a"
,
t
)
}
func
TestPrecompiledBLS12381G1Mul
(
t
*
testing
.
T
)
{
testJson
(
"blsG1Mul"
,
"0b"
,
t
)
}
func
TestPrecompiledBLS12381G1MultiExp
(
t
*
testing
.
T
)
{
testJson
(
"blsG1MultiExp"
,
"0c"
,
t
)
}
func
TestPrecompiledBLS12381G2Add
(
t
*
testing
.
T
)
{
testJson
(
"blsG2Add"
,
"0d"
,
t
)
}
func
TestPrecompiledBLS12381G2Mul
(
t
*
testing
.
T
)
{
testJson
(
"blsG2Mul"
,
"0e"
,
t
)
}
func
TestPrecompiledBLS12381G2MultiExp
(
t
*
testing
.
T
)
{
testJson
(
"blsG2MultiExp"
,
"0f"
,
t
)
}
func
TestPrecompiledBLS12381Pairing
(
t
*
testing
.
T
)
{
testJson
(
"blsPairing"
,
"10"
,
t
)
}
func
TestPrecompiledBLS12381MapG1
(
t
*
testing
.
T
)
{
testJson
(
"blsMapG1"
,
"11"
,
t
)
}
func
TestPrecompiledBLS12381MapG2
(
t
*
testing
.
T
)
{
testJson
(
"blsMapG2"
,
"12"
,
t
)
}
func
TestPrecompiledPointEvaluation
(
t
*
testing
.
T
)
{
testJson
(
"pointEvaluation"
,
"14"
,
t
)
}
func
BenchmarkPrecompiledBLS12381G1Add
(
b
*
testing
.
B
)
{
benchJson
(
"blsG1Add"
,
"0a"
,
b
)
}
func
BenchmarkPrecompiledBLS12381G1Mul
(
b
*
testing
.
B
)
{
benchJson
(
"blsG1Mul"
,
"0b"
,
b
)
}
func
BenchmarkPrecompiledBLS12381G1MultiExp
(
b
*
testing
.
B
)
{
benchJson
(
"blsG1MultiExp"
,
"0c"
,
b
)
}
func
BenchmarkPrecompiledBLS12381G2Add
(
b
*
testing
.
B
)
{
benchJson
(
"blsG2Add"
,
"0d"
,
b
)
}
func
BenchmarkPrecompiledBLS12381G2Mul
(
b
*
testing
.
B
)
{
benchJson
(
"blsG2Mul"
,
"0e"
,
b
)
}
func
BenchmarkPrecompiledBLS12381G2MultiExp
(
b
*
testing
.
B
)
{
benchJson
(
"blsG2MultiExp"
,
"0f"
,
b
)
}
func
BenchmarkPrecompiledBLS12381Pairing
(
b
*
testing
.
B
)
{
benchJson
(
"blsPairing"
,
"10"
,
b
)
}
func
BenchmarkPrecompiledBLS12381MapG1
(
b
*
testing
.
B
)
{
benchJson
(
"blsMapG1"
,
"11"
,
b
)
}
func
BenchmarkPrecompiledBLS12381MapG2
(
b
*
testing
.
B
)
{
benchJson
(
"blsMapG2"
,
"12"
,
b
)
}
func
TestPrecompiledBLS12381G1Add
(
t
*
testing
.
T
)
{
testJson
(
"blsG1Add"
,
"f0a"
,
t
)
}
func
TestPrecompiledBLS12381G1Mul
(
t
*
testing
.
T
)
{
testJson
(
"blsG1Mul"
,
"f0b"
,
t
)
}
func
TestPrecompiledBLS12381G1MultiExp
(
t
*
testing
.
T
)
{
testJson
(
"blsG1MultiExp"
,
"f0c"
,
t
)
}
func
TestPrecompiledBLS12381G2Add
(
t
*
testing
.
T
)
{
testJson
(
"blsG2Add"
,
"f0d"
,
t
)
}
func
TestPrecompiledBLS12381G2Mul
(
t
*
testing
.
T
)
{
testJson
(
"blsG2Mul"
,
"f0e"
,
t
)
}
func
TestPrecompiledBLS12381G2MultiExp
(
t
*
testing
.
T
)
{
testJson
(
"blsG2MultiExp"
,
"f0f"
,
t
)
}
func
TestPrecompiledBLS12381Pairing
(
t
*
testing
.
T
)
{
testJson
(
"blsPairing"
,
"f10"
,
t
)
}
func
TestPrecompiledBLS12381MapG1
(
t
*
testing
.
T
)
{
testJson
(
"blsMapG1"
,
"f11"
,
t
)
}
func
TestPrecompiledBLS12381MapG2
(
t
*
testing
.
T
)
{
testJson
(
"blsMapG2"
,
"f12"
,
t
)
}
func
TestPrecompiledPointEvaluation
(
t
*
testing
.
T
)
{
testJson
(
"pointEvaluation"
,
"0a"
,
t
)
}
func
BenchmarkPrecompiledBLS12381G1Add
(
b
*
testing
.
B
)
{
benchJson
(
"blsG1Add"
,
"f0a"
,
b
)
}
func
BenchmarkPrecompiledBLS12381G1Mul
(
b
*
testing
.
B
)
{
benchJson
(
"blsG1Mul"
,
"f0b"
,
b
)
}
func
BenchmarkPrecompiledBLS12381G1MultiExp
(
b
*
testing
.
B
)
{
benchJson
(
"blsG1MultiExp"
,
"f0c"
,
b
)
}
func
BenchmarkPrecompiledBLS12381G2Add
(
b
*
testing
.
B
)
{
benchJson
(
"blsG2Add"
,
"f0d"
,
b
)
}
func
BenchmarkPrecompiledBLS12381G2Mul
(
b
*
testing
.
B
)
{
benchJson
(
"blsG2Mul"
,
"f0e"
,
b
)
}
func
BenchmarkPrecompiledBLS12381G2MultiExp
(
b
*
testing
.
B
)
{
benchJson
(
"blsG2MultiExp"
,
"f0f"
,
b
)
}
func
BenchmarkPrecompiledBLS12381Pairing
(
b
*
testing
.
B
)
{
benchJson
(
"blsPairing"
,
"f10"
,
b
)
}
func
BenchmarkPrecompiledBLS12381MapG1
(
b
*
testing
.
B
)
{
benchJson
(
"blsMapG1"
,
"f11"
,
b
)
}
func
BenchmarkPrecompiledBLS12381MapG2
(
b
*
testing
.
B
)
{
benchJson
(
"blsMapG2"
,
"f12"
,
b
)
}
// Failure tests
func
TestPrecompiledBLS12381G1AddFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsG1Add"
,
"0a"
,
t
)
}
func
TestPrecompiledBLS12381G1MulFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsG1Mul"
,
"0b"
,
t
)
}
func
TestPrecompiledBLS12381G1MultiExpFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsG1MultiExp"
,
"0c"
,
t
)
}
func
TestPrecompiledBLS12381G2AddFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsG2Add"
,
"0d"
,
t
)
}
func
TestPrecompiledBLS12381G2MulFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsG2Mul"
,
"0e"
,
t
)
}
func
TestPrecompiledBLS12381G2MultiExpFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsG2MultiExp"
,
"0f"
,
t
)
}
func
TestPrecompiledBLS12381PairingFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsPairing"
,
"10"
,
t
)
}
func
TestPrecompiledBLS12381MapG1Fail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsMapG1"
,
"11"
,
t
)
}
func
TestPrecompiledBLS12381MapG2Fail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsMapG2"
,
"12"
,
t
)
}
func
TestPrecompiledBLS12381G1AddFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsG1Add"
,
"
f
0a"
,
t
)
}
func
TestPrecompiledBLS12381G1MulFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsG1Mul"
,
"
f
0b"
,
t
)
}
func
TestPrecompiledBLS12381G1MultiExpFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsG1MultiExp"
,
"
f
0c"
,
t
)
}
func
TestPrecompiledBLS12381G2AddFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsG2Add"
,
"
f
0d"
,
t
)
}
func
TestPrecompiledBLS12381G2MulFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsG2Mul"
,
"
f
0e"
,
t
)
}
func
TestPrecompiledBLS12381G2MultiExpFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsG2MultiExp"
,
"
f
0f"
,
t
)
}
func
TestPrecompiledBLS12381PairingFail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsPairing"
,
"
f
10"
,
t
)
}
func
TestPrecompiledBLS12381MapG1Fail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsMapG1"
,
"
f
11"
,
t
)
}
func
TestPrecompiledBLS12381MapG2Fail
(
t
*
testing
.
T
)
{
testJsonFail
(
"blsMapG2"
,
"
f
12"
,
t
)
}
func
loadJson
(
name
string
)
([]
precompiledTest
,
error
)
{
data
,
err
:=
os
.
ReadFile
(
fmt
.
Sprintf
(
"testdata/precompiles/%v.json"
,
name
))
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment