Conversation
cfa0c5c to
fc67071
Compare
| LastTransHash Bits256 | ||
| LastTransLt uint64 | ||
|
|
||
| accountCell *boc.Cell |
There was a problem hiding this comment.
Как будто бы, есть очень много мест, где ячейка может оказаться обрезанная. Может есть какой-то способ сделать это лучше (у нас есть pruned resolver, но если на этапе десериализации мы не знаем, что подставить вместо хэша, то он не поможет)
| case reflect.Pointer: | ||
| if val.IsNil() && !t.IsOptional { | ||
| return fmt.Errorf("can't encode empty pointer %v if tlb scheme is not optional", val.Type()) | ||
| if val.IsNil() { |
There was a problem hiding this comment.
А почему это валидный кейс?
| name := val.FieldByName("SumType").String() | ||
|
|
||
| if name == "" { | ||
| // Default to the first non-SumType field (zero variant) |
There was a problem hiding this comment.
А зачем сериализовать структуру, у которой пустой SumType? Как будто бы лучше вернуть ошибку, чем пытаться сериализовать её хоть как-то
| if len(h.values) == 0 || h.values == nil { | ||
| return nil | ||
| } | ||
| order := sortedIndices(h.keys) |
There was a problem hiding this comment.
А зачем? Не очень понял зачем нужно сортировать ключи. И ещё анмаршалинг и маршалинг все равно не работает на достаточно большом боке
|
|
||
| import "github.com/tonkeeper/tongo/boc" | ||
|
|
||
| func cloneCell(c *boc.Cell) *boc.Cell { |
There was a problem hiding this comment.
Может стоит привязать этот метод к boc.Cell. По Аналогии с boc.Cell.CopyRemaining()
| func (a MsgAddress) MarshalTLB(c *boc.Cell, encoder *Encoder) error { | ||
| switch a.SumType { | ||
| case "AddrNone": | ||
| case "AddrNone", "": |
There was a problem hiding this comment.
Кажется, если у MsgAddress нет сум типа, то это ошибка и не стоит маршалить в AddrNone
|
|
||
| func (m Magic) EncodeTag(c *boc.Cell, tag string) error { | ||
| if tag == "" { | ||
| return c.WriteUint(uint64(m), 32) |
There was a problem hiding this comment.
Magic не всегда имеет длину 32. Может быть и поменьше. Да и не очень понятно, когда такое может произойти при нормальном поведении, а даже если произошло, то скорее нужно ошибку выбросить
| Left ShardStateUnsplit `tlb:"^"` // ^ but decodes manually | ||
| Right ShardStateUnsplit `tlb:"^"` // ^ but decodes manually | ||
| } `tlbSumType:"split_state#5f327da5"` | ||
|
|
There was a problem hiding this comment.
Тоже самое, выглядит костыльно пихать эти ячейки туда, где могут оказаться обрезанные
| func (t VmStkTuple) MarshalTLB(c *boc.Cell, encoder *Encoder) error { | ||
| // TODO: implement | ||
| return fmt.Errorf("VmStkTuple TLB marshaling not implemented") | ||
| if err := c.WriteUint(uint64(t.Len), 16); err != nil { |
8adb081 to
792e5b2
Compare
792e5b2 to
01b6833
Compare
No description provided.