Skip to content

Commit e907339

Browse files
committed
feat: v3 test pass
1 parent 6432d21 commit e907339

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

cmd/sequence/payload.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ func handleToAbi(p *PayloadToAbiParams) (string, error) {
1919
}
2020

2121
func handleToPacked(p *PayloadToPackedParams) (string, error) {
22-
log.Printf("payload: %s", p.Payload)
2322
decoded, err := v3.DecodeABIPayload(p.Payload)
2423
if err != nil {
2524
return "", fmt.Errorf("failed to decode ABI payload: %w", err)

core/v3/payload.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,6 @@ func DecodeABIPayload(input string) (DecodedPayload, error) {
471471
return DecodedPayload{}, fmt.Errorf("failed to unmarshal decoded data: %w", err)
472472
}
473473

474-
log.Printf("Decoded: Space=%s, Nonce=%s, Calls=%d", payload.Space.String(), payload.Nonce.String(), len(payload.Calls))
475-
476474
return payload, nil
477475
}
478476

@@ -482,7 +480,6 @@ func ConvertToAbi(payload string) (string, error) {
482480
}
483481

484482
func ConvertToPacked(payload string) (string, error) {
485-
log.Printf("payload: %s", payload)
486483
decoded, err := DecodeABIPayload(payload)
487484
if err != nil {
488485
return "", fmt.Errorf("failed to decode ABI payload: %w", err)

core/v3/v3.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ import (
2020
)
2121

2222
const (
23-
nestedLeafImageHashPrefix = "Sequence nested config:\n"
24-
subdigestLeafImageHashPrefix = "Sequence static digest:\n"
23+
addressLeafImageHashPrefix = "Sequence signer:\n"
24+
nestedLeafImageHashPrefix = "Sequence nested config:\n"
25+
sapientLeafImageHashPrefix = "Sequence sapient config:\n"
26+
subdigestLeafImageHashPrefix = "Sequence static digest:\n"
27+
anyAddressSubdigestLeafImageHashPrefix = "Sequence any address subdigest:\n"
2528
)
2629

2730
var Core core.Core[*WalletConfig, core.Signature[*WalletConfig]] = v3Core{}
@@ -1553,7 +1556,7 @@ func (l *signatureTreeAnyAddressSubdigestLeaf) join(other signatureTree) (signat
15531556

15541557
func (l *signatureTreeAnyAddressSubdigestLeaf) reduceImageHash() (core.ImageHash, error) {
15551558
return core.ImageHash{Hash: crypto.Keccak256Hash(
1556-
[]byte("Sequence any address subdigest:\n"),
1559+
[]byte(anyAddressSubdigestLeafImageHashPrefix),
15571560
l.Subdigest.Bytes(),
15581561
)}, nil
15591562
}
@@ -2195,7 +2198,7 @@ func (l *WalletConfigTreeAddressLeaf) ImageHash() core.ImageHash {
21952198
weight.FillBytes(weightBytes)
21962199

21972200
hash := crypto.Keccak256Hash(
2198-
[]byte("Sequence signer:\n"),
2201+
[]byte(addressLeafImageHashPrefix),
21992202
l.Address.Bytes(),
22002203
weightBytes,
22012204
)
@@ -2510,7 +2513,7 @@ func (l *WalletConfigTreeSapientSignerLeaf) ImageHash() core.ImageHash {
25102513
weight.FillBytes(weightBytes)
25112514

25122515
hash := crypto.Keccak256Hash(
2513-
[]byte("Sequence sapient config:\n"),
2516+
[]byte(sapientLeafImageHashPrefix),
25142517
l.Address.Bytes(),
25152518
weightBytes,
25162519
l.ImageHash_.Bytes(),
@@ -2588,7 +2591,7 @@ func decodeWalletConfigTreeAnyAddressSubdigestLeaf(object any) (WalletConfigTree
25882591

25892592
func (l WalletConfigTreeAnyAddressSubdigestLeaf) ImageHash() core.ImageHash {
25902593
hash := crypto.Keccak256Hash(
2591-
[]byte("Sequence any address subdigest:\n"),
2594+
[]byte(anyAddressSubdigestLeafImageHashPrefix),
25922595
l.Digest.Bytes(),
25932596
)
25942597
return core.ImageHash{
@@ -2656,12 +2659,6 @@ func minBytesForUint16(value uint16) byte {
26562659
}
26572660
return 2
26582661
}
2659-
func minWeightBytes(weight uint64) uint8 {
2660-
if weight <= 3 {
2661-
return 0
2662-
}
2663-
return minBytesFor(weight)
2664-
}
26652662

26662663
func bitsFor(val uint64) int {
26672664
if val == 0 {

0 commit comments

Comments
 (0)