Skip to content

Commit

Permalink
e2e test fix and cr fix
Browse files Browse the repository at this point in the history
  • Loading branch information
novosandara committed Mar 26, 2024
1 parent 845579b commit fb0ee29
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
13 changes: 9 additions & 4 deletions e2e-polybft/e2e/jsonrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ func TestE2E_JsonRPC(t *testing.T) {
require.NoError(t, err)

require.Equal(t, txReceipt.BlockNumber, header.Number)
require.Equal(t, txReceipt.BlockHash, header.Hash)
require.Equal(t, txReceipt.BlockHash, ethgo.Hash(header.Hash))
})

t.Run("eth_getHeaderByHash", func(t *testing.T) {
Expand All @@ -445,7 +445,7 @@ func TestE2E_JsonRPC(t *testing.T) {
require.NoError(t, err)

require.Equal(t, txReceipt.BlockNumber, header.Number)
require.Equal(t, txReceipt.BlockHash, header.Hash)
require.Equal(t, txReceipt.BlockHash, ethgo.Hash(header.Hash))
})

t.Run("txpool_contentFrom", func(t *testing.T) {
Expand All @@ -457,11 +457,16 @@ func TestE2E_JsonRPC(t *testing.T) {
require.True(t, txn.Succeed())
txReceipt := txn.Receipt()

var contentFrom map[uint64]*ethgo.Transaction
type ContentAddressResponse struct {
Pending map[uint64]*ethgo.Transaction `json:"pending"`
Queued map[uint64]*ethgo.Transaction `json:"queued"`
}

var contentFrom ContentAddressResponse
err = jsonRPC.Call("txpool_contentFrom", &contentFrom, key1.Address())
require.NoError(t, err)

require.Equal(t, txReceipt.TransactionHash, contentFrom[txn.Txn().Nonce()].Hash)
require.Equal(t, txReceipt.TransactionHash, contentFrom.Pending[txn.Txn().Nonce()].Hash)
})

t.Run("debug_traceTransaction", func(t *testing.T) {
Expand Down
10 changes: 8 additions & 2 deletions jsonrpc/txpool_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ func TestContentFrom(t *testing.T) {
mockStore.queued[address2] = []*types.Transaction{testTx2}
txPoolEndpoint := &TxPool{mockStore}

result, _ := txPoolEndpoint.ContentFrom(address2)
result, err := txPoolEndpoint.ContentFrom(address2)
assert.NoError(t, err)

response := result.(ContentAddressResponse)
assert.Equal(t, 1, len(response.Queued))
Expand Down Expand Up @@ -264,12 +265,17 @@ func TestContentFrom(t *testing.T) {
mockStore.queued[address2] = []*types.Transaction{testTx5}
txPoolEndpoint := &TxPool{mockStore}

result, _ := txPoolEndpoint.ContentFrom(address2)
result, err := txPoolEndpoint.ContentFrom(address2)
assert.NoError(t, err)

response := result.(ContentAddressResponse)

assert.True(t, mockStore.includeQueued)
assert.Equal(t, 1, len(response.Pending))
assert.Equal(t, testTx4.Hash(), response.Pending[testTx4.Nonce()].Hash)
assert.Equal(t, 1, len(response.Queued))
assert.Equal(t, testTx5.Hash(), response.Queued[testTx5.Nonce()].Hash)

})

Check failure on line 279 in jsonrpc/txpool_endpoint_test.go

View workflow job for this annotation

GitHub Actions / Lint / Run Lint

unnecessary trailing newline (whitespace)
}

Expand Down

0 comments on commit fb0ee29

Please sign in to comment.