Skip to content

Commit

Permalink
Make empty pending follow previous block's GasPriceSTRK
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfirmak committed Nov 30, 2023
1 parent 5bec171 commit bef6e78
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ func (b *Blockchain) storeEmptyPending(txn db.Transaction, latestHeader *core.He
ProtocolVersion: latestHeader.ProtocolVersion,
EventsBloom: core.EventsBloom(receipts),
GasPrice: latestHeader.GasPrice,
GasPriceSTRK: latestHeader.GasPriceSTRK,
},
Transactions: make([]core.Transaction, 0),
Receipts: receipts,
Expand Down
2 changes: 2 additions & 0 deletions blockchain/blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ func TestPending(t *testing.T) {
assert.Equal(t, pendingGenesis, gotPending)
})

b.GasPriceSTRK = utils.HexToFelt(t, "0xDEADBEEF")
require.NoError(t, chain.Store(b, &emptyCommitments, su, nil))

t.Run("no pending block means pending state matches head state", func(t *testing.T) {
Expand All @@ -670,6 +671,7 @@ func TestPending(t *testing.T) {
require.Equal(t, b.Timestamp+1, pending.Block.Timestamp)
require.Equal(t, b.SequencerAddress, pending.Block.SequencerAddress)
require.Equal(t, b.GasPrice, pending.Block.GasPrice)
require.Equal(t, b.GasPriceSTRK, pending.Block.GasPriceSTRK)
require.Equal(t, b.ProtocolVersion, pending.Block.ProtocolVersion)
require.Equal(t, su.NewRoot, pending.StateUpdate.OldRoot)
require.Empty(t, pending.StateUpdate.StateDiff.Nonces)
Expand Down

0 comments on commit bef6e78

Please sign in to comment.