Skip to content

Commit

Permalink
update ntt transfer wire format
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-gray committed Mar 1, 2024
1 parent 5cec110 commit 3838921
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions node/pkg/accountant/ntt.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ var NTT_PREFIX = []byte{0x99, 0x4E, 0x54, 0x54}
// isNTT determines if the payload bytes are for a Native Token Transfer, according to the following implementation:
// https://github.com/wormhole-foundation/example-native-token-transfers/blob/41ac7baae5bb0f60fff2ec87603970af39dced01/test/EndpointStructs.t.sol
func nttIsPayloadNTT(payload []byte) bool {
if len(payload) < 116 {
if len(payload) < 140 {
return false
}

if !bytes.Equal(payload[0:4], WH_PREFIX) {
return false
}

if !bytes.Equal(payload[112:116], NTT_PREFIX) {
if !bytes.Equal(payload[136:140], NTT_PREFIX) {
return false
}

Expand Down
2 changes: 1 addition & 1 deletion node/pkg/accountant/ntt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/wormhole-foundation/wormhole/sdk/vaa"
)

const goodPayload = "9945ff10042942fafabe0000000000000000000000000000000000000000000000000000042942fababe00000000000000000000000000000000000000000000000000000079000000367999a1014667921341234300000000000000000000000000000000000000000000000000004f994e545407000000000012d687beefface00000000000000000000000000000000000000000000000000000000feebcafe0000000000000000000000000000000000000000000000000000000000110000"
const goodPayload = "9945ff10042942fafabe0000000000000000000000000000000000000000000000000000042942fababe00000000000000000000000000000000000000000000000000000091128434bafe23430000000000000000000000000000000000ce00aa00000000004667921341234300000000000000000000000000000000000000000000000000004f994e545407000000000012d687beefface00000000000000000000000000000000000000000000000000000000feebcafe0000000000000000000000000000000000000000000000000000000000110000"

func TestNttParsePayloadSuccess(t *testing.T) {
payload, err := hex.DecodeString(goodPayload)
Expand Down

0 comments on commit 3838921

Please sign in to comment.