Skip to content
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

harness: Update eth to work with geth 1.14 and up. #3123

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JoeGruffins
Copy link
Member

@JoeGruffins JoeGruffins commented Dec 18, 2024

closes #3122

Also no longer using the deprecated personal namespace

@JoeGruffins
Copy link
Member Author

Does polygon need all the same changes?

@JoeGruffins JoeGruffins force-pushed the updateethharness branch 3 times, most recently from b5883f0 to f8ce2cf Compare December 20, 2024 09:22
@@ -114,7 +114,7 @@ tmux send-keys -t $SESSION:0 "${DAEMON} -rpcuser=user -rpcpassword=pass \
-rpcport=${ALPHA_RPC_PORT} -datadir=${ALPHA_DIR} $(deprecateddbd $ALPHA_DESCRIPTOR_WALLET) \
-debug=rpc -debug=net -debug=mempool -debug=walletdb -debug=addrman -debug=mempoolrej \
-whitelist=127.0.0.0/8 -whitelist=::1 \
-txindex=1 -regtest=1 -port=${ALPHA_LISTEN_PORT} -fallbackfee=0.00001 \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Bitcoin core v28.0.0 for some reason this wasn't using the port anymore. Using bind seems to work...

Copy link
Contributor

@dev-warrior777 dev-warrior777 Dec 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried bitcoin core v22-1 and it accepts -bind=12345 but does not make a listening tcpip port.

2024-12-25T07:55:25Z Command-line arg: bind="12345"
2024-12-25T07:55:25Z Command-line arg: server="1"

netstat -tl <- no new port. i.e. it fails silently!

-port=12345 does make port:

tcp        0      0 0.0.0.0:12345           0.0.0.0:*               LISTEN     
tcp6       0      0 [::]:12345              [::]:*                  LISTEN     

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So -bind does not work on earlier versions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot say all earlier but I suspect so

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just did a quiick search on bitcoin and it looks a bit more complex ..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try just setting both...

@JoeGruffins JoeGruffins marked this pull request as ready for review December 20, 2024 09:24
@JoeGruffins
Copy link
Member Author

I was going to update the internal eth nodes, but its adding a toolchain to the go.mod and we didn't want that for some reason. I guess we will have to add it to update though?

@JoeGruffins
Copy link
Member Author

The harness just mines whenever there is a transaction, which is unfortunate, but the mining scrip needs to be updated to reflect this. Also some tests in /client/asset/eth are broken still.

@JoeGruffins
Copy link
Member Author

Fixing the mining script https://github.com/decred/dcrdex/compare/726f473c18811544c6624b9239ddb78b555fe86f..b983ef294ec3571e685b9751863fc5de947ab172

I also tried setting --dev.period 10 but for some reason no transactions are mined then. That may be useful for testing if we can figure it out.

@JoeGruffins JoeGruffins force-pushed the updateethharness branch 2 times, most recently from e9173f2 to 4f832eb Compare December 25, 2024 09:07
@JoeGruffins
Copy link
Member Author

Fixing tests and apparently gas for token swaps is less now https://github.com/decred/dcrdex/compare/b983ef294ec3571e685b9751863fc5de947ab172..4f832ebf1086d67112a0cae15b7c3a55c65032ae

Also, I had to update to 1.14.12 because HeaderByNumber was returning an incorrect header on simnet.

@JoeGruffins JoeGruffins force-pushed the updateethharness branch 2 times, most recently from 7469a1d to ef12c81 Compare February 3, 2025 07:32
@JoeGruffins
Copy link
Member Author

It looks like the newest version 1.14.13 does not require the toolchain thing to go.mod

@JoeGruffins
Copy link
Member Author

@JoeGruffins JoeGruffins requested a review from martonp February 4, 2025 00:34
Copy link
Collaborator

@martonp martonp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried --dev.period and it worked for me: b6ba4cd

I removed the mine-alpha script as well, since the mining is automatically handled by geth. The only issue I had was that it would only mine one transaction per block, and I'm not sure why. The gas ceiling is higher than all of the pending transactions.

Comment on lines -4930 to +4934
if info.MaxSwapsInTx != 20 {
t.Fatalf("expected 20 for max swaps but got %d", info.MaxSwapsInTx)
if info.MaxSwapsInTx != 24 {
t.Fatalf("expected 24 for max swaps but got %d", info.MaxSwapsInTx)
}
if info.MaxRedeemsInTx != 45 {
t.Fatalf("expected 45 for max redemptions but got %d", info.MaxRedeemsInTx)
if info.MaxRedeemsInTx != 55 {
t.Fatalf("expected 55 for max redemptions but got %d", info.MaxRedeemsInTx)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did these change?

Copy link
Member Author

@JoeGruffins JoeGruffins Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The values are different with the changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads up that #2038 removes these fields from WalletInfo and we calculate them dynamically instead.

dex/networks/eth/params.go Outdated Show resolved Hide resolved
server/asset/eth/eth.go Outdated Show resolved Hide resolved
dex/networks/erc20/contracts/TestToken.sol Outdated Show resolved Hide resolved

function setSenderBalance (tokenAddr, amt) {
var testToken = contract.at(tokenAddr)
return testToken.setSenderBalance(amt*1000000)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in some contract the decimal will not be 6. You could check the decimals in the contract and multiply based on that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking out the conversion so the caller can do it. Hope thats good enough.

dex/testing/eth/harness.sh Outdated Show resolved Hide resolved
@JoeGruffins
Copy link
Member Author

I tried --dev.period and it worked for me: b6ba4cd

I removed the mine-alpha script as well, since the mining is automatically handled by geth. The only issue I had was that it would only mine one transaction per block, and I'm not sure why. The gas ceiling is higher than all of the pending transactions.

Yeah there was some reason the dev.period didnt work out, I think that's why. We can't work with one tx per block can we?

@JoeGruffins JoeGruffins force-pushed the updateethharness branch 2 times, most recently from a9b7a67 to 6c261a4 Compare February 6, 2025 09:16
@JoeGruffins
Copy link
Member Author

JoeGruffins commented Feb 6, 2025

Reverted the test contract changes, fix most of martons review topics, also removing mining from the loadbot setup. The extra mining seems to be causing problems for geth and its not necessary in my opinion. https://github.com/decred/dcrdex/compare/a9b7a67d37daa752b7849579eb4c22e9aaf9ee22..6c261a4d1b727e0cfe0ba869a5814760eb600cdd

Still using the mining script in the eth harness because we can't do with slow transactions. I guess it is mining one block per transaction though, now, so its a bit unnatural still.

@martonp
Copy link
Collaborator

martonp commented Feb 6, 2025

Yeah there was some reason the dev.period didnt work out, I think that's why. We can't work with one tx per block can we?

I think it's fine, generally we won't have more than 1 tx per block, and it's more realistic than immediately mining a block only when there is a transaction. I'm pretty sure we're doing something wrong though.. I don't think dev.period would have this restriction. I've messed with the gas ceiling and wasn't able to get it to work.

@JoeGruffins
Copy link
Member Author

The loadbot will produce many txn per second, and I use that alot. We can always adjust the scripts manually to meet our needs I suppose. I will look into if I am implementing this wrong. I haven't found anything yet about it only being 1 tx per block googling around. Unsure yet if that's by design.

@JoeGruffins JoeGruffins marked this pull request as draft February 7, 2025 09:41
@JoeGruffins
Copy link
Member Author

There`s some time dilation going on. The longer the dev node runs, the further the header's time drifts into the future. This means any contracts based off of local time will eventually be expired before created based on the chain's time. May be due to the fast blocks.

Prints from where we watch blocks:

block 92 header time 2025-02-07 18:36:28 +0900 JST my time 2025-02-07 18:35:27.463838776 +0900 JST
block 829 header time 2025-02-07 18:49:14 +0900 JST my time 2025-02-07 18:45:22.460241287 +0900 JST

@@ -71,6 +72,7 @@ func runTrader(t Trader, name string) {
}

maintain := true
time.Sleep(time.Second * 16) // at least a block for reg funds
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to also listen for ctx.Done here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

harness: Update to work with geth v1.13.x +
4 participants