File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ impl<A> LinearCostPrecompile for Ed25519Verify<A>
2121where
2222 A : From < [ u8 ; 32 ] > ,
2323{
24+ // https://eips.ethereum.org/EIPS/eip-665#gas-costs
25+ // According to the EIP, the base cost should be 2000 gas, less than ECDSA/secp256k1 which is 3000.
26+ // Reality: Ed25519 verification is ~2.3x more computationally expensive than ECDSA/secp256k1
27+ // So we set the base cost to 6000 gas, which is 3x of the EIP's base cost.
2428 const BASE : u64 = 6000 ;
2529 const WORD : u64 = 0 ;
2630
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ impl<A> LinearCostPrecompile for Sr25519Verify<A>
2222where
2323 A : From < [ u8 ; 32 ] > ,
2424{
25+ // There is no EIP for SR25519, so we use the same base cost as Ed25519.
2526 const BASE : u64 = 6000 ;
2627 const WORD : u64 = 0 ;
2728
You can’t perform that action at this time.
0 commit comments