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

Commit 6ea794b

Browse files
committed
Fixed/added tests along petersburg introduction
1 parent b89edc7 commit 6ea794b

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

tests/chains.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ tape('[Common]: Initialization / Chain params', function(t: tape.Test) {
139139
'should throw an exception on missing parameter',
140140
) // eslint-disable-line no-new
141141

142+
st.comment('-----------------------------------------------------------------')
142143
st.end()
143144
})
144145
})

tests/genesisStates.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ tape('[genesisStates]: Genesis state access', function(t: tape.Test) {
1717
'Access by name (goerli)',
1818
)
1919

20+
st.comment('-----------------------------------------------------------------')
2021
st.end()
2122
})
2223
})

tests/hardforks.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) {
7070

7171
t.test('activeHardforks()', function(st: tape.Test) {
7272
let c = new Common('ropsten')
73-
st.equal(c.activeHardforks().length, 5, 'should return 5 active hardforks for Ropsten')
73+
st.equal(c.activeHardforks().length, 7, 'should return 7 active hardforks for Ropsten')
7474
st.equal(
7575
c.activeHardforks()[3]['name'],
7676
'spuriousDragon',
@@ -88,6 +88,13 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) {
8888
)
8989

9090
c = new Common('ropsten', null, ['spuriousDragon', 'byzantium', 'constantinople'])
91+
st.equal(
92+
c.activeHardforks(null, { onlySupported: true }).length,
93+
3,
94+
'should return 3 active HFs when restricted to supported HFs',
95+
)
96+
97+
c = new Common('ropsten', null, ['spuriousDragon', 'byzantium', 'dao'])
9198
st.equal(
9299
c.activeHardforks(null, { onlySupported: true }).length,
93100
2,
@@ -101,8 +108,8 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) {
101108
let c = new Common('ropsten')
102109
st.equal(
103110
c.activeHardfork(),
104-
'byzantium',
105-
'should return byzantium as latest active HF for Ropsten',
111+
'petersburg',
112+
'should return petersburg as latest active HF for Ropsten',
106113
)
107114
st.equal(
108115
c.activeHardfork(10),
@@ -171,11 +178,11 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) {
171178
'Ropsten, constantinople >= byzantium (provided) -> true',
172179
)
173180
st.equal(
174-
c.hardforkGteHardfork('constantinople', 'byzantium', {
181+
c.hardforkGteHardfork('dao', 'chainstart', {
175182
onlyActive: true,
176183
}),
177184
false,
178-
'Ropsten, constantinople >= byzantium (provided), onlyActive -> fale',
185+
'Ropsten, dao >= chainstart (provided), onlyActive -> false',
179186
)
180187
st.equal(
181188
c.hardforkGteHardfork('byzantium', 'byzantium'),
@@ -231,9 +238,9 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) {
231238
'should return false for dao (provided) on Ropsten',
232239
)
233240
st.equal(
234-
c.hardforkIsActiveOnChain('constantinople'),
235-
false,
236-
'should return false for constantinople (provided) on Ropsten',
241+
c.hardforkIsActiveOnChain('petersburg'),
242+
true,
243+
'should return true for petersburg (provided) on Ropsten',
237244
)
238245
st.equal(
239246
c.hardforkIsActiveOnChain('notexistinghardfork'),
@@ -269,6 +276,7 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) {
269276
st.equal(c.consensus('constantinople'), 'pow', 'should return pow for constantinople consensus')
270277
st.equal(c.finality('byzantium'), null, 'should return null for byzantium finality')
271278

279+
st.comment('-----------------------------------------------------------------')
272280
st.end()
273281
})
274282
})

tests/params.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ tape('[Common]: Parameter access', function(t: tape.Test) {
8787
200,
8888
'Should return updated sstore gas prices for constantinople',
8989
)
90+
st.equal(
91+
c.param('gasPrices', 'netSstoreNoopGas', 'petersburg'),
92+
null,
93+
'Should nullify SSTORE related values for petersburg',
94+
)
9095

9196
st.end()
9297
})
@@ -105,6 +110,7 @@ tape('[Common]: Parameter access', function(t: tape.Test) {
105110
'Should correctly translate block numbers into HF states (original value)',
106111
)
107112

113+
st.comment('-----------------------------------------------------------------')
108114
st.end()
109115
})
110116
})

0 commit comments

Comments
 (0)