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

How get stateUpdate by accountBlock? #238

Open
fishTsai20 opened this issue Aug 22, 2024 · 2 comments
Open

How get stateUpdate by accountBlock? #238

fishTsai20 opened this issue Aug 22, 2024 · 2 comments

Comments

@fishTsai20
Copy link

var ab tlb.AccountBlock
if err = tlb.LoadFromCell(&ab, slc); err != nil {
return fmt.Errorf("faled to parse account block: %w", err)
}
addr := address.NewAddress(0, byte(0), ab.Addr)
log.Info("account block's ", zap.Any("address", addr))
//state_update:^(HASH_UPDATE Account)
update := ab.StateUpdate.BeginParse()
var stateUpdate tlb.HashUpdate
err = tlb.LoadFromCell(&stateUpdate, update)
if err != nil {
log.Error("failed to get stateUpdate of account", zap.Any("address", addr), zap.Error(err))
return err
}

failed to get stateUpdate of account {"address": "EQAzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM7SN", "error": "magic is not correct for tlb.HashUpdate, want #72"}

@xssnick
Copy link
Owner

xssnick commented Aug 23, 2024

Hi, it looks like a different data inside ab.StateUpdate, you can do println(ab.StateUpdate.Dump()) to check, maybe it is pruned (collapsed part of merkle proof)

@fishTsai20
Copy link
Author

9[500_] -> { 700[7333333333333333333333333333333333333333333333333333333333333333300002C285E7463C1848974E46DC8A97C4504891082FC0CA7C3BAACF53246573BA115992C293DEE8400002C285E65218266C31A96000140_] -> { 2[0_], 520[72EEA4BB9B1F6083C49D08F503E9DCBFF278E79253AF02972D54674716F85D8ADAD2CB747F6C5D680946ADE5E14E054E1140F676ACADF3051F98BE0AA11520861D], 21[203020] -> { 640[43281010B0760000000000000000009600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000], 365[C00000000000000000000000012D452DA449E50B8CF7DD27861F146122AFE1B546BB8B70FC8216F0C614139F8E00] } } }
Didn't see any Pruned Branch Cell.
Isn't your type definition consistent with TON's?
https://github.com/ton-blockchain/ton/blob/24dc184a2ea67f9c47042b4104bbb4d82289fac1/crypto/block/block.tlb#L231-L233
How do I parse this StateUpdate ?

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

No branches or pull requests

2 participants