Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #18 from ethereumjs/fix-gas-price-names
Browse files Browse the repository at this point in the history
Remove leftover *Gas postfix for some gas prices
  • Loading branch information
holgerd77 authored Jun 20, 2018
2 parents b26620e + 19f94f2 commit f1198a8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions hardforks/byzantium.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
"v": 20,
"d": "Gquaddivisor from modexp precompile for gas calculation"
},
"ecAddGas": {
"ecAdd": {
"v": 500,
"d": "Gas costs for curve addition precompile"
},
"ecMulGas": {
"ecMul": {
"v": 40000,
"d": "Gas costs for curve multiplication precompile"
},
"ecPairingGas": {
"ecPairing": {
"v": 100000,
"d": "Base gas costs for curve pairing precompile"
},
"ecPairingWordGas": {
"ecPairingWord": {
"v": 80000,
"d": "Gas costs regarding curve pairing precompile input length"
}
Expand Down
14 changes: 7 additions & 7 deletions hardforks/chainstart.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,31 +133,31 @@
"v": 3,
"d": "Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added"
},
"ecrecoverGas": {
"ecRecover": {
"v": 3000,
"d": ""
},
"sha256Gas": {
"sha256": {
"v": 60,
"d": ""
},
"sha256WordGas": {
"sha256Word": {
"v": 12,
"d": ""
},
"ripemd160Gas": {
"ripemd160": {
"v": 600,
"d": ""
},
"ripemd160WordGas": {
"ripemd160Word": {
"v": 120,
"d": ""
},
"identityGas": {
"identity": {
"v": 15,
"d": ""
},
"identityWordGas": {
"identityWord": {
"v": 3,
"d": ""
}
Expand Down
12 changes: 6 additions & 6 deletions tests/params.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ const Common = require('../index.js')
tape('[Common]: Parameter access', function (t) {
t.test('Basic usage', function (st) {
let c = new Common('mainnet')
st.equal(c.param('gasPrices', 'ecAddGas', 'byzantium'), 500, 'Should return correct value when HF directly provided')
st.equal(c.param('gasPrices', 'ecAdd', 'byzantium'), 500, 'Should return correct value when HF directly provided')

c.setHardfork('byzantium')
st.equal(c.param('gasPrices', 'ecAddGas'), 500, 'Should return correct value for HF set in class')
st.equal(c.param('gasPrices', 'ecAdd'), 500, 'Should return correct value for HF set in class')

st.end()
})

t.test('Error cases', function (st) {
let c = new Common('mainnet')
st.throws(function () { c.param('gasPrices', 'ecAddGas') }, /neither a hardfork set nor provided by param$/, 'Should throw when no hardfork set or provided')
st.throws(function () { c.param('gasPrizes', 'ecAddGas', 'byzantium') }, /Topic gasPrizes not defined$/, 'Should throw when called with non-existing topic')
st.throws(function () { c.param('gasPrices', 'ecAdd') }, /neither a hardfork set nor provided by param$/, 'Should throw when no hardfork set or provided')
st.throws(function () { c.param('gasPrizes', 'ecAdd', 'byzantium') }, /Topic gasPrizes not defined$/, 'Should throw when called with non-existing topic')
st.throws(function () { c.param('gasPrices', 'notexistingvalue', 'byzantium') }, /value for notexistingvalue not found$/, 'Should throw when called with non-existing value')

c.setHardfork('byzantium')
st.equal(c.param('gasPrices', 'ecAddGas'), 500, 'Should return correct value for HF set in class')
st.equal(c.param('gasPrices', 'ecAdd'), 500, 'Should return correct value for HF set in class')

c = new Common('mainnet', 'byzantium', ['byzantium', 'constantinople'])
st.throws(function () { c.param('gasPrices', 'expByte', 'spuriousDragon') }, /supportedHardforks$/, 'Should throw when calling param() with an unsupported hardfork')
Expand All @@ -30,7 +30,7 @@ tape('[Common]: Parameter access', function (t) {

t.test('Parameter updates', function (st) {
let c = new Common('mainnet')
st.throws(function () { c.param('gasPrices', 'ecAddGas', 'spuriousDragon') }, /value for ecAddGas not found$/, 'Should throw for a value set on a later HF')
st.throws(function () { c.param('gasPrices', 'ecAdd', 'spuriousDragon') }, /value for ecAdd not found$/, 'Should throw for a value set on a later HF')

st.equal(c.param('pow', 'minerReward', 'chainstart'), '5000000000000000000', 'Should return correct value for chain start')
st.equal(c.param('pow', 'minerReward', 'byzantium'), '3000000000000000000', 'Should reflect HF update changes')
Expand Down

0 comments on commit f1198a8

Please sign in to comment.