-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
Get Account balance from Peer by Snap Protocol #29755
Comments
That should work. Are you sure the peer you're connecting to / the root hash in the request is valid? The peer is returning an address very very close to what you requested, as if that one didn't exist, so giving you the next one in line. For what is worth, the reply also contains a Merkle proof that can "prove" that between the hash you requested and the hash returned there are no accounts, but for that you need to implement validating the proofs too. My gut feeling is that there's something wrong on your end because Geth's snap sync works correctly, so it would be very off if it's skipping something. That said, it wouldn't be the first time there's a bug, so if you can send us a more complete repro to run against say a mainnet code, we can investigate some more. |
I don't know what you're doing here (did you alias account address:="0xC0fcFAd6a5db86F566102B8a7115823068a93c50"
startingHash:=crypto.Keccak256Hash(address[:]) but, func TestFoobar(t *testing.T) {
address := "0xC0fcFAd6a5db86F566102B8a7115823068a93c50"
startingHash := crypto.Keccak256Hash([]byte(address[:]))
t.Logf("hash %#x", startingHash)
addr := common.HexToAddress("0xC0fcFAd6a5db86F566102B8a7115823068a93c50")
t.Logf("addr %v hash %#x", addr, crypto.Keccak256(addr[:]))
}
The hash you should wind up with is |
@holiman This is wrong, this hashes the ASCII of the address. You need address = common.HexToAddres("..."). And then hash those bytes. OP's code was correct, they were just giving the example data. |
I know that was wrong. I tried to see if that's what op was doing (it wasn't). The second one was correct (?) |
As I've already explained, though: |
@holiman , you are right. i used wrong method, thanks!. i closed this issue. |
i am testing method GetAccountRange in Snap Protocool https://github.com/ethereum/devp2p/blob/master/caps/snap.md
this is my code:
i am using conn.snapRequest in above code from this : conn from this https://github.com/ethereum/go-ethereum/blob/master/cmd/devp2p/internal/ethtest/conn.go
When i excuted above code, this is result:
My questions: why result from Peer is differenent my account? seem that is difference account.
The text was updated successfully, but these errors were encountered: