-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client/eth: Fix test gas calculations. #1346
Conversation
I believe this does fix some random errors, but not any called out in the issues... |
tx, blockHash, _, index, err := n.leth.ApiBackend.GetTransaction(ctx, txHash) | ||
if err != nil { | ||
return nil, nil | ||
return nil, err | ||
} | ||
if tx == nil { | ||
return nil, fmt.Errorf("transaction %v not found", txHash) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some convo in #1327
The nil check is very helpful for debugging.
client/asset/eth/nodeclient.go
Outdated
@@ -513,7 +518,7 @@ func (n *nodeClient) transactionConfirmations(ctx context.Context, txHash common | |||
// tx pool, and when our peers are ready to supply the info. I saw a | |||
// CoinNotFoundError in TestAccount/testSendTransaction, but haven't | |||
// reproduced. | |||
return 0, asset.CoinNotFoundError | |||
return 0, fmt.Errorf("cannot find %v: %w", txHash, asset.CoinNotFoundError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this randomly hit sometimes, but other nodes do see the tx. I don't know why it's being missed. Would make sense though if related to the issue with missing txs the first try in #1327
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at btc and dcr, it seems that we are always returning the asset.CoinNotFoundError
unwrapped. In core, we are always using errors.Is
, so this won't matter for us. But any consumer using direct comparison, if err == asset.CoinNotFoundError
, would now behave differently.
1d9c954
to
ca58da8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, tests passed on a fresh harness.
client/asset/eth/nodeclient.go
Outdated
@@ -209,6 +209,8 @@ func (n *nodeClient) balance(ctx context.Context) (*Balance, error) { | |||
|
|||
for _, tx := range pendingTxs { | |||
from, _ := ethSigner.Sender(tx) // zero Address on error | |||
// Intentionally ignoring receives from addresses that do not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think those would even be listed in pending transactions... I think this is more of a sanity check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "those" receives from addresses that do not belong to the wallet? I think this will show all txs in the mempool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From go-ethereum/light/txpool.go
// TxPool implements the transaction pool for light clients, which keeps track
// of the status of locally created transactions, ...
More accurately, ignoring transactions that are not from us
, but that's really what the code says, so I don't know that the doc adds much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the doc.
ca58da8
to
4bfdc35
Compare
Oh man, after rebase tests are failing in two spots consistently:
and
What happened. anyone else? I updated to geth 1.10.13 |
Looks like due to the key derivation change in c54f8d1 , the The new derivation gives these values:
|
Ah dang, my bad. Didn't anticipate the hard coded eth keys in the harness. |
Ok, just need to change the keys then. Will do. Thx @martonp |
client/asset/eth/nodeclient.go
Outdated
@@ -513,7 +518,7 @@ func (n *nodeClient) transactionConfirmations(ctx context.Context, txHash common | |||
// tx pool, and when our peers are ready to supply the info. I saw a | |||
// CoinNotFoundError in TestAccount/testSendTransaction, but haven't | |||
// reproduced. | |||
return 0, asset.CoinNotFoundError | |||
return 0, fmt.Errorf("cannot find %v: %w", txHash, asset.CoinNotFoundError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at btc and dcr, it seems that we are always returning the asset.CoinNotFoundError
unwrapped. In core, we are always using errors.Is
, so this won't matter for us. But any consumer using direct comparison, if err == asset.CoinNotFoundError
, would now behave differently.
@@ -682,8 +689,12 @@ func testInitiate(t *testing.T) { | |||
t.Fatalf("%s: balance error: %v", test.name, err) | |||
} | |||
|
|||
gasPrice, err := feesAtBlk(ctx, ethClient, receipt.BlockNumber.Int64()-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that the transaction was not being included in the block we expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it just means that the base fee for a block is encoded in (or calculated from) the previous block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it's in the header, the latest commit makes more sense for getting the base fee from mined blocks.
f49c8f5
to
d7f4e22
Compare
Is there a issue for this error? https://github.com/decred/dcrdex/runs/4654985696?check_suite_focus=true |
looks new |
Is it #1268 ? Looks very similar. |
f41d149
to
c96b28b
Compare
Just rebased. |
Need to rebase again. |
Yeah, sorry @JoeGruffins. This PR is g2g, but I merged @martonp's token nodeclient PR first. |
Use the base gas fee for the block before a tx was mined to caculate exact gas used and test using that expected amount.
c96b28b
to
2aaf6a8
Compare
closes #1342