Skip to content

Commit

Permalink
Build fix after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbundalo committed Feb 20, 2024
1 parent 3f5b546 commit 45320fb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions blockchain/storage/leveldb/leveldb_perf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func createTxs(t *testing.T, startNonce, count int, from types.Address, to *type
txs := make([]*types.Transaction, count)

for i := range txs {
tx := &types.Transaction{
tx := types.NewTx(&types.MixedTxn{
Gas: types.StateTransactionGasLimit,
Nonce: uint64(startNonce + i),
From: from,
Expand All @@ -32,7 +32,7 @@ func createTxs(t *testing.T, startNonce, count int, from types.Address, to *type
Type: types.DynamicFeeTx,
GasFeeCap: big.NewInt(100),
GasTipCap: big.NewInt(10),
}
})

txs[i] = tx
}
Expand Down Expand Up @@ -82,7 +82,7 @@ func createBlock(t *testing.T) *types.FullBlock {

for i := 0; i < len(b.Block.Transactions); i++ {
b.Receipts[i] = &types.Receipt{
TxHash: b.Block.Transactions[i].Hash,
TxHash: b.Block.Transactions[i].Hash(),
Root: types.StringToHash("mockhashstring"),
TransactionType: types.LegacyTx,
GasUsed: uint64(100000),
Expand Down Expand Up @@ -149,9 +149,9 @@ func updateBlock(t *testing.T, num uint64, b *types.FullBlock) *types.FullBlock
b.Block.Header.ParentHash = types.StringToHash(randStringBytes(12))
for i := range b.Block.Transactions {
addr = types.StringToAddress(randStringBytes(8))
b.Block.Transactions[i].To = &addr
b.Block.Transactions[i].SetTo(&addr)
b.Block.Transactions[i].ComputeHash()
b.Receipts[i].TxHash = b.Block.Transactions[i].Hash
b.Receipts[i].TxHash = b.Block.Transactions[i].Hash()
}
// big := new(big.Int)
// big.SetInt64(int64(num))
Expand All @@ -171,7 +171,7 @@ func prepareBatch(t *testing.T, s storage.Storage, b *types.FullBlock) *storage.
batchWriter.PutHeadHash(b.Block.Header.Hash)
batchWriter.PutHeadNumber(b.Block.Number())
for _, tx := range b.Block.Transactions {
batchWriter.PutTxLookup(tx.Hash, b.Block.Hash())
batchWriter.PutTxLookup(tx.Hash(), b.Block.Hash())
}

// Main DB sorted
Expand Down
12 changes: 6 additions & 6 deletions blockchain/storageV2/leveldb/leveldb_perf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func createTxs(t *testing.T, startNonce, count int, from types.Address, to *type
txs := make([]*types.Transaction, count)

for i := range txs {
tx := &types.Transaction{
tx := types.NewTx(&types.MixedTxn{
Gas: types.StateTransactionGasLimit,
Nonce: uint64(startNonce + i),
From: from,
Expand All @@ -33,7 +33,7 @@ func createTxs(t *testing.T, startNonce, count int, from types.Address, to *type
Type: types.DynamicFeeTx,
GasFeeCap: big.NewInt(100),
GasTipCap: big.NewInt(10),
}
})

txs[i] = tx
}
Expand Down Expand Up @@ -83,7 +83,7 @@ func createBlock(t *testing.T) *types.FullBlock {

for i := 0; i < len(b.Block.Transactions); i++ {
b.Receipts[i] = &types.Receipt{
TxHash: b.Block.Transactions[i].Hash,
TxHash: b.Block.Transactions[i].Hash(),
Root: types.StringToHash("mockhashstring"),
TransactionType: types.LegacyTx,
GasUsed: uint64(100000),
Expand Down Expand Up @@ -150,9 +150,9 @@ func updateBlock(t *testing.T, num uint64, b *types.FullBlock) *types.FullBlock
b.Block.Header.ParentHash = types.StringToHash(randStringBytes(12))
for i := range b.Block.Transactions {
addr = types.StringToAddress(randStringBytes(8))
b.Block.Transactions[i].To = &addr
b.Block.Transactions[i].SetTo(&addr)
b.Block.Transactions[i].ComputeHash()
b.Receipts[i].TxHash = b.Block.Transactions[i].Hash
b.Receipts[i].TxHash = b.Block.Transactions[i].Hash()
}
// big := new(big.Int)
// big.SetInt64(int64(num))
Expand All @@ -173,7 +173,7 @@ func prepareBatch(t *testing.T, s *storageV2.Storage, b *types.FullBlock) *stora
batchWriter.PutHeadNumber(b.Block.Number())
batchWriter.PutBlockLookup(b.Block.Hash(), b.Block.Number())
for _, tx := range b.Block.Transactions {
batchWriter.PutTxLookup(tx.Hash, b.Block.Number())
batchWriter.PutTxLookup(tx.Hash(), b.Block.Number())
}

// Main DB sorted
Expand Down
8 changes: 4 additions & 4 deletions blockchain/storageV2/leveldb/leveldb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func generateTxs(t *testing.T, startNonce, count int, from types.Address, to *ty
txs := make([]*types.Transaction, count)

for i := range txs {
tx := &types.Transaction{
tx := types.NewTx(&types.MixedTxn{
Gas: types.StateTransactionGasLimit,
Nonce: uint64(startNonce + i),
From: from,
Expand All @@ -63,7 +63,7 @@ func generateTxs(t *testing.T, startNonce, count int, from types.Address, to *ty
Type: types.DynamicFeeTx,
GasFeeCap: big.NewInt(100),
GasTipCap: big.NewInt(10),
}
})

input := make([]byte, 1000)
_, err := rand.Read(input)
Expand Down Expand Up @@ -110,7 +110,7 @@ func generateBlock(t *testing.T, num uint64) *types.FullBlock {

for i := 0; i < len(b.Block.Transactions); i++ {
b.Receipts[i] = &types.Receipt{
TxHash: b.Block.Transactions[i].Hash,
TxHash: b.Block.Transactions[i].Hash(),
Root: types.StringToHash("mockhashstring"),
TransactionType: types.LegacyTx,
GasUsed: uint64(100000),
Expand Down Expand Up @@ -233,7 +233,7 @@ insertloop:
batchWriter.PutBody(b.Block.Number(), b.Block.Body())

for _, tx := range b.Block.Transactions {
batchWriter.PutTxLookup(tx.Hash, b.Block.Number())
batchWriter.PutTxLookup(tx.Hash(), b.Block.Number())
}

batchWriter.PutHeader(b.Block.Header)
Expand Down
18 changes: 9 additions & 9 deletions blockchain/storageV2/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,27 +260,27 @@ func testBody(t *testing.T, m PlaceholderStorage) {
require.NoError(t, batch.WriteBatch())

addr1 := types.StringToAddress("11")
t0 := &types.Transaction{
t0 := types.NewTx(&types.MixedTxn{
Nonce: 0,
To: &addr1,
Value: big.NewInt(1),
Gas: 11,
GasPrice: big.NewInt(11),
Input: []byte{1, 2},
V: big.NewInt(1),
}
})
t0.ComputeHash()

addr2 := types.StringToAddress("22")
t1 := &types.Transaction{
t1 := types.NewTx(&types.MixedTxn{
Nonce: 0,
To: &addr2,
Value: big.NewInt(1),
Gas: 22,
GasPrice: big.NewInt(11),
Input: []byte{4, 5},
V: big.NewInt(2),
}
})
t1.ComputeHash()

block := types.Block{
Expand All @@ -305,7 +305,7 @@ func testBody(t *testing.T, m PlaceholderStorage) {
}

for indx, i := range tx0 {
if i.Hash != tx1[indx].Hash {
if i.Hash() != tx1[indx].Hash() {
t.Fatal("tx not correct")
}
}
Expand All @@ -328,19 +328,19 @@ func testReceipts(t *testing.T, m PlaceholderStorage) {

body := &types.Body{
Transactions: []*types.Transaction{
{
types.NewTx(&types.MixedTxn{
Nonce: 1000,
Gas: 50,
GasPrice: new(big.Int).SetUint64(100),
V: big.NewInt(11),
},
}),
},
}
receipts := []*types.Receipt{
{
Root: types.StringToHash("1"),
CumulativeGasUsed: 10,
TxHash: body.Transactions[0].Hash,
TxHash: body.Transactions[0].Hash(),
LogsBloom: types.Bloom{0x1},
Logs: []*types.Log{
{
Expand All @@ -357,7 +357,7 @@ func testReceipts(t *testing.T, m PlaceholderStorage) {
{
Root: types.StringToHash("1"),
CumulativeGasUsed: 10,
TxHash: body.Transactions[0].Hash,
TxHash: body.Transactions[0].Hash(),
LogsBloom: types.Bloom{0x1},
GasUsed: 10,
ContractAddress: &types.Address{0x1},
Expand Down

0 comments on commit 45320fb

Please sign in to comment.