Update VAA structure
This commit is contained in:
parent
135b98e556
commit
59449a30b3
|
@ -3,105 +3,233 @@ package main
|
||||||
import (
|
import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"fmt"
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"math/big"
|
"math/big"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
|
||||||
|
|
||||||
"github.com/certusone/wormhole/bridge/pkg/devnet"
|
"github.com/certusone/wormhole/bridge/pkg/devnet"
|
||||||
"github.com/certusone/wormhole/bridge/pkg/vaa"
|
"github.com/certusone/wormhole/bridge/pkg/vaa"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
type signerInfo struct {
|
||||||
addr := devnet.GanacheClientDefaultAccountAddress
|
signer *ecdsa.PrivateKey
|
||||||
addrP := common.LeftPadBytes(addr[:], 32)
|
index int
|
||||||
addrTarget := vaa.Address{}
|
}
|
||||||
copy(addrTarget[:], addrP)
|
|
||||||
|
|
||||||
tAddr := common.HexToAddress("0x0000000000000000000000009561c133dd8580860b6b7e504bc5aa500f0f06a7")
|
func main() {
|
||||||
tAddrP := common.LeftPadBytes(tAddr[:], 32)
|
|
||||||
tAddrTarget := vaa.Address{}
|
keys := generateKeys(6)
|
||||||
copy(tAddrTarget[:], tAddrP)
|
for i, key := range keys {
|
||||||
v := &vaa.VAA{
|
fmt.Printf("Key [%d]: %s\n", i, crypto.PubkeyToAddress(key.PublicKey).String())
|
||||||
|
}
|
||||||
|
|
||||||
|
signAndPrintVAA(&vaa.VAA{
|
||||||
Version: 1,
|
Version: 1,
|
||||||
GuardianSetIndex: 2,
|
GuardianSetIndex: 0,
|
||||||
Timestamp: time.Unix(4000, 0),
|
Timestamp: time.Unix(2000, 0),
|
||||||
Payload: &vaa.BodyTransfer{
|
Payload: &vaa.BodyTransfer{
|
||||||
Nonce: 56,
|
Nonce: 56,
|
||||||
SourceChain: 1,
|
SourceChain: 1,
|
||||||
TargetChain: 2,
|
TargetChain: 2,
|
||||||
SourceAddress: vaa.Address{2, 1, 4},
|
SourceAddress: vaa.Address{2, 1, 4},
|
||||||
TargetAddress: addrTarget,
|
TargetAddress: padAddress(devnet.GanacheClientDefaultAccountAddress),
|
||||||
Asset: &vaa.AssetMeta{
|
Asset: &vaa.AssetMeta{
|
||||||
Chain: vaa.ChainIDSolana,
|
Chain: vaa.ChainIDSolana,
|
||||||
Address: tAddrTarget,
|
Address: hexToAddress("0x347ef34687bdc9f189e87a9200658d9c40e9988"),
|
||||||
},
|
},
|
||||||
Amount: big.NewInt(1000000000000000000),
|
Amount: big.NewInt(1000000000000000000),
|
||||||
},
|
},
|
||||||
}
|
}, []*signerInfo{{keys[0], 0}})
|
||||||
|
|
||||||
r := rand.New(rand.NewSource(555))
|
signAndPrintVAA(&vaa.VAA{
|
||||||
key, err := ecdsa.GenerateKey(crypto.S256(), r)
|
Version: 1,
|
||||||
if err != nil {
|
GuardianSetIndex: 0,
|
||||||
panic(err)
|
Timestamp: time.Unix(2000, 0),
|
||||||
}
|
Payload: &vaa.BodyTransfer{
|
||||||
key2, err := ecdsa.GenerateKey(crypto.S256(), r)
|
Nonce: 56,
|
||||||
if err != nil {
|
SourceChain: 1,
|
||||||
panic(err)
|
TargetChain: 2,
|
||||||
}
|
SourceAddress: vaa.Address{2, 1, 4},
|
||||||
key3, err := ecdsa.GenerateKey(crypto.S256(), r)
|
TargetAddress: padAddress(devnet.GanacheClientDefaultAccountAddress),
|
||||||
if err != nil {
|
Asset: &vaa.AssetMeta{
|
||||||
panic(err)
|
Chain: vaa.ChainIDEthereum,
|
||||||
}
|
Address: hexToAddress("0xd833215cbcc3f914bd1c9ece3ee7bf8b14f841bb"),
|
||||||
key4, err := ecdsa.GenerateKey(crypto.S256(), r)
|
},
|
||||||
if err != nil {
|
Amount: big.NewInt(1000000000000000000),
|
||||||
panic(err)
|
},
|
||||||
}
|
}, []*signerInfo{{keys[0], 0}})
|
||||||
key5, err := ecdsa.GenerateKey(crypto.S256(), r)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
key6, err := ecdsa.GenerateKey(crypto.S256(), r)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
//v = &vaa.VAA{
|
signAndPrintVAA(&vaa.VAA{
|
||||||
// Version: 1,
|
Version: 1,
|
||||||
// GuardianSetIndex: 1,
|
GuardianSetIndex: 0,
|
||||||
// Timestamp: time.Unix(5000, 0),
|
Timestamp: time.Unix(2000, 0),
|
||||||
// Payload: &vaa.BodyGuardianSetUpdate{
|
Payload: &vaa.BodyGuardianSetUpdate{
|
||||||
// Keys: []common.Address{
|
Keys: []common.Address{
|
||||||
// crypto.PubkeyToAddress(key.PublicKey),
|
crypto.PubkeyToAddress(keys[1].PublicKey),
|
||||||
// crypto.PubkeyToAddress(key2.PublicKey),
|
},
|
||||||
// crypto.PubkeyToAddress(key3.PublicKey),
|
NewIndex: 1,
|
||||||
// crypto.PubkeyToAddress(key4.PublicKey),
|
},
|
||||||
// crypto.PubkeyToAddress(key5.PublicKey),
|
}, []*signerInfo{{keys[0], 0}})
|
||||||
// crypto.PubkeyToAddress(key6.PublicKey),
|
|
||||||
// },
|
|
||||||
// NewIndex: 2,
|
|
||||||
// },
|
|
||||||
//}
|
|
||||||
|
|
||||||
v.AddSignature(key, 0)
|
signAndPrintVAA(&vaa.VAA{
|
||||||
v.AddSignature(key2, 1)
|
Version: 1,
|
||||||
v.AddSignature(key3, 2)
|
GuardianSetIndex: 0,
|
||||||
v.AddSignature(key5, 4)
|
Timestamp: time.Unix(2000, 0),
|
||||||
v.AddSignature(key6, 5)
|
Payload: &vaa.BodyGuardianSetUpdate{
|
||||||
sigAddr := crypto.PubkeyToAddress(key.PublicKey)
|
Keys: []common.Address{
|
||||||
println(sigAddr.String())
|
crypto.PubkeyToAddress(keys[2].PublicKey),
|
||||||
println(crypto.PubkeyToAddress(key2.PublicKey).String())
|
},
|
||||||
println(crypto.PubkeyToAddress(key3.PublicKey).String())
|
NewIndex: 1,
|
||||||
println(crypto.PubkeyToAddress(key4.PublicKey).String())
|
},
|
||||||
println(crypto.PubkeyToAddress(key5.PublicKey).String())
|
}, []*signerInfo{{keys[0], 0}})
|
||||||
println(crypto.PubkeyToAddress(key6.PublicKey).String())
|
|
||||||
|
|
||||||
vData, err := v.Marshal()
|
signAndPrintVAA(&vaa.VAA{
|
||||||
|
Version: 1,
|
||||||
|
GuardianSetIndex: 0,
|
||||||
|
Timestamp: time.Unix(1000, 0),
|
||||||
|
Payload: &vaa.BodyTransfer{
|
||||||
|
Nonce: 56,
|
||||||
|
SourceChain: 1,
|
||||||
|
TargetChain: 2,
|
||||||
|
SourceAddress: vaa.Address{2, 1, 4},
|
||||||
|
TargetAddress: padAddress(devnet.GanacheClientDefaultAccountAddress),
|
||||||
|
Asset: &vaa.AssetMeta{
|
||||||
|
Chain: vaa.ChainIDSolana,
|
||||||
|
Address: hexToAddress("0x347ef34687bdc9f189e87a9200658d9c40e9988"),
|
||||||
|
},
|
||||||
|
Amount: big.NewInt(1000000000000000000),
|
||||||
|
},
|
||||||
|
}, []*signerInfo{{keys[0], 0}})
|
||||||
|
|
||||||
|
signAndPrintVAA(&vaa.VAA{
|
||||||
|
Version: 1,
|
||||||
|
GuardianSetIndex: 0,
|
||||||
|
Timestamp: time.Unix(2000, 0),
|
||||||
|
Payload: &vaa.BodyTransfer{
|
||||||
|
Nonce: 56,
|
||||||
|
SourceChain: 1,
|
||||||
|
TargetChain: 2,
|
||||||
|
SourceAddress: vaa.Address{2, 1, 5},
|
||||||
|
TargetAddress: padAddress(devnet.GanacheClientDefaultAccountAddress),
|
||||||
|
Asset: &vaa.AssetMeta{
|
||||||
|
Chain: vaa.ChainIDSolana,
|
||||||
|
Address: hexToAddress("0x347ef34687bdc9f189e87a9200658d9c40e9988"),
|
||||||
|
},
|
||||||
|
Amount: big.NewInt(1000000000000000000),
|
||||||
|
},
|
||||||
|
}, []*signerInfo{{keys[0], 0}})
|
||||||
|
|
||||||
|
signAndPrintVAA(&vaa.VAA{
|
||||||
|
Version: 1,
|
||||||
|
GuardianSetIndex: 1,
|
||||||
|
Timestamp: time.Unix(2000, 0),
|
||||||
|
Payload: &vaa.BodyTransfer{
|
||||||
|
Nonce: 56,
|
||||||
|
SourceChain: 1,
|
||||||
|
TargetChain: 2,
|
||||||
|
SourceAddress: vaa.Address{2, 1, 5},
|
||||||
|
TargetAddress: padAddress(devnet.GanacheClientDefaultAccountAddress),
|
||||||
|
Asset: &vaa.AssetMeta{
|
||||||
|
Chain: vaa.ChainIDSolana,
|
||||||
|
Address: hexToAddress("0x347ef34687bdc9f189e87a9200658d9c40e9988"),
|
||||||
|
},
|
||||||
|
Amount: big.NewInt(1000000000000000000),
|
||||||
|
},
|
||||||
|
}, []*signerInfo{{keys[1], 0}})
|
||||||
|
|
||||||
|
signAndPrintVAA(&vaa.VAA{
|
||||||
|
Version: 1,
|
||||||
|
GuardianSetIndex: 1,
|
||||||
|
Timestamp: time.Unix(4000, 0),
|
||||||
|
Payload: &vaa.BodyGuardianSetUpdate{
|
||||||
|
Keys: []common.Address{
|
||||||
|
crypto.PubkeyToAddress(keys[0].PublicKey),
|
||||||
|
crypto.PubkeyToAddress(keys[1].PublicKey),
|
||||||
|
crypto.PubkeyToAddress(keys[2].PublicKey),
|
||||||
|
crypto.PubkeyToAddress(keys[3].PublicKey),
|
||||||
|
crypto.PubkeyToAddress(keys[4].PublicKey),
|
||||||
|
crypto.PubkeyToAddress(keys[5].PublicKey),
|
||||||
|
},
|
||||||
|
NewIndex: 2,
|
||||||
|
},
|
||||||
|
}, []*signerInfo{{keys[1], 0}})
|
||||||
|
|
||||||
|
signAndPrintVAA(&vaa.VAA{
|
||||||
|
Version: 1,
|
||||||
|
GuardianSetIndex: 2,
|
||||||
|
Timestamp: time.Unix(4000, 0),
|
||||||
|
Payload: &vaa.BodyTransfer{
|
||||||
|
Nonce: 57,
|
||||||
|
SourceChain: 1,
|
||||||
|
TargetChain: 2,
|
||||||
|
SourceAddress: vaa.Address{2, 1, 5},
|
||||||
|
TargetAddress: padAddress(devnet.GanacheClientDefaultAccountAddress),
|
||||||
|
Asset: &vaa.AssetMeta{
|
||||||
|
Chain: vaa.ChainIDSolana,
|
||||||
|
Address: hexToAddress("0x347ef34687bdc9f189e87a9200658d9c40e9988"),
|
||||||
|
},
|
||||||
|
Amount: big.NewInt(1000000000000000000),
|
||||||
|
},
|
||||||
|
}, []*signerInfo{{keys[0], 0}, {keys[1], 1}, {keys[2], 2}})
|
||||||
|
|
||||||
|
signAndPrintVAA(&vaa.VAA{
|
||||||
|
Version: 1,
|
||||||
|
GuardianSetIndex: 2,
|
||||||
|
Timestamp: time.Unix(4000, 0),
|
||||||
|
Payload: &vaa.BodyTransfer{
|
||||||
|
Nonce: 57,
|
||||||
|
SourceChain: 1,
|
||||||
|
TargetChain: 2,
|
||||||
|
SourceAddress: vaa.Address{2, 1, 5},
|
||||||
|
TargetAddress: padAddress(devnet.GanacheClientDefaultAccountAddress),
|
||||||
|
Asset: &vaa.AssetMeta{
|
||||||
|
Chain: vaa.ChainIDSolana,
|
||||||
|
Address: hexToAddress("0x347ef34687bdc9f189e87a9200658d9c40e9988"),
|
||||||
|
},
|
||||||
|
Amount: big.NewInt(1000000000000000000),
|
||||||
|
},
|
||||||
|
}, []*signerInfo{{keys[0], 0}, {keys[1], 1}, {keys[3], 3}, {keys[4], 4}, {keys[5], 5}})
|
||||||
|
}
|
||||||
|
|
||||||
|
func signAndPrintVAA(vaa *vaa.VAA, signers []*signerInfo) {
|
||||||
|
for _, signer := range signers {
|
||||||
|
vaa.AddSignature(signer.signer, uint8(signer.index))
|
||||||
|
}
|
||||||
|
vData, err := vaa.Marshal()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
println(hex.EncodeToString(vData))
|
println(hex.EncodeToString(vData))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func generateKeys(n int) (keys []*ecdsa.PrivateKey) {
|
||||||
|
r := rand.New(rand.NewSource(555))
|
||||||
|
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
key, err := ecdsa.GenerateKey(crypto.S256(), r)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
keys = append(keys, key)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func hexToAddress(hex string) vaa.Address {
|
||||||
|
hexAddr := common.HexToAddress(hex)
|
||||||
|
return padAddress(hexAddr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func padAddress(address common.Address) vaa.Address {
|
||||||
|
paddedAddress := common.LeftPadBytes(address[:], 32)
|
||||||
|
|
||||||
|
addr := vaa.Address{}
|
||||||
|
copy(addr[:], paddedAddress)
|
||||||
|
|
||||||
|
return addr
|
||||||
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -145,15 +144,16 @@ func Unmarshal(data []byte) (*VAA, error) {
|
||||||
}
|
}
|
||||||
v.Timestamp = time.Unix(int64(unixSeconds), 0)
|
v.Timestamp = time.Unix(int64(unixSeconds), 0)
|
||||||
|
|
||||||
currentPos := len(data) - reader.Len()
|
var (
|
||||||
action := data[currentPos]
|
action uint8
|
||||||
payloadLength := data[currentPos+1]
|
)
|
||||||
|
if err := binary.Read(reader, binary.BigEndian, &action); err != nil {
|
||||||
if len(data[currentPos+2:]) != int(payloadLength) {
|
return nil, fmt.Errorf("failed to read action: %w", err)
|
||||||
return nil, fmt.Errorf("payload length does not match given payload data size")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
payloadReader := bytes.NewReader(data[currentPos+2:])
|
currentPos := len(data) - reader.Len()
|
||||||
|
|
||||||
|
payloadReader := bytes.NewReader(data[currentPos:])
|
||||||
var err error
|
var err error
|
||||||
switch Action(action) {
|
switch Action(action) {
|
||||||
case ActionGuardianSetUpdate:
|
case ActionGuardianSetUpdate:
|
||||||
|
@ -250,10 +250,6 @@ func (v *VAA) serializeBody() ([]byte, error) {
|
||||||
return nil, fmt.Errorf("failed to serialize payload: %w", err)
|
return nil, fmt.Errorf("failed to serialize payload: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(payloadData) > math.MaxUint8 {
|
|
||||||
return nil, fmt.Errorf("payload size exceeds maximum")
|
|
||||||
}
|
|
||||||
MustWrite(buf, binary.BigEndian, uint8(len(payloadData)))
|
|
||||||
buf.Write(payloadData)
|
buf.Write(payloadData)
|
||||||
|
|
||||||
return buf.Bytes(), nil
|
return buf.Bytes(), nil
|
||||||
|
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func TestSerializeDeserialize(t *testing.T) {
|
func TestSerializeDeserialize(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
@ -66,11 +65,11 @@ func TestSerializeDeserialize(t *testing.T) {
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
|
||||||
vaaData, err := test.vaa.Serialize()
|
vaaData, err := test.vaa.Marshal()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
println(hex.EncodeToString(vaaData))
|
println(hex.EncodeToString(vaaData))
|
||||||
vaaParsed, err := ParseVAA(vaaData)
|
vaaParsed, err := Unmarshal(vaaData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
require.EqualValues(t, test.vaa, vaaParsed)
|
require.EqualValues(t, test.vaa, vaaParsed)
|
||||||
|
|
|
@ -145,7 +145,6 @@ uint8 index of the signer (in guardian keys)
|
||||||
body:
|
body:
|
||||||
uint32 unix seconds
|
uint32 unix seconds
|
||||||
uint8 action
|
uint8 action
|
||||||
uint8 payload_size
|
|
||||||
[payload_size]uint8 payload
|
[payload_size]uint8 payload
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -111,8 +111,7 @@ contract Wormhole {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 action = vaa.toUint8(offset + 4);
|
uint8 action = vaa.toUint8(offset + 4);
|
||||||
uint8 payload_len = vaa.toUint8(offset + 5);
|
bytes memory payload = vaa.slice(offset + 5, vaa.length - (offset + 5));
|
||||||
bytes memory payload = vaa.slice(offset + 6, payload_len);
|
|
||||||
|
|
||||||
// Process VAA
|
// Process VAA
|
||||||
if (action == 0x01) {
|
if (action == 0x01) {
|
||||||
|
|
|
@ -2,11 +2,9 @@ const WrappedAsset = artifacts.require("WrappedAsset");
|
||||||
const Wormhole = artifacts.require("Wormhole");
|
const Wormhole = artifacts.require("Wormhole");
|
||||||
|
|
||||||
module.exports = async function (deployer) {
|
module.exports = async function (deployer) {
|
||||||
await deployer.deploy(WrappedAsset);
|
|
||||||
// FIXME: this offsets the deleted Schnorr contract to keep the previous deterministic addresses
|
|
||||||
await deployer.deploy(WrappedAsset);
|
await deployer.deploy(WrappedAsset);
|
||||||
await deployer.deploy(Wormhole, {
|
await deployer.deploy(Wormhole, {
|
||||||
keys: ["0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf"],
|
keys: ["0xbeFA429d57cD18b7F8A4d91A2da9AB4AF05d0FBe"],
|
||||||
expiration_time: 0
|
expiration_time: 0
|
||||||
}, WrappedAsset.address, 1000);
|
}, WrappedAsset.address, 1000);
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,25 +54,24 @@ contract("Wormhole", function () {
|
||||||
let bridge = await Wormhole.deployed();
|
let bridge = await Wormhole.deployed();
|
||||||
|
|
||||||
// User locked an asset on the foreign chain and the VAA proving this is transferred in.
|
// User locked an asset on the foreign chain and the VAA proving this is transferred in.
|
||||||
await bridge.submitVAA("0x0100000000010092737a1504f3b3df8c93cb85c64a4860bb270e26026b6e37f095356a406f6af439c6b2e9775fa1c6669525f06edab033ba5d447308f4e3bdb33c0f361dc32ec3015f3700081087000000350102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e99880000000000000000000000000000000000000000000000004563918244f40000")
|
await bridge.submitVAA("0x01000000000100eecb367540286d326e333ea06542b82d3feaeb0dc33b1b14bda8cdf8287da2a630a9a6692112bcedee501c0947c607081d51426fa1982ef342c07f4502b584c801000007d010000000380102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e99880000000000000000000000000000000000000000000000000de0b6b3a7640000")
|
||||||
|
|
||||||
// Expect user to have a balance of a new wrapped asset
|
// Expect user to have a balance of a new wrapped asset
|
||||||
|
|
||||||
// submitVAA has automatically created a new WrappedAsset for the foreign asset that has been transferred in.
|
// submitVAA has automatically created a new WrappedAsset for the foreign asset that has been transferred in.
|
||||||
// We know the address because deterministic network. A user would see the address in the submitVAA tx log.
|
// We know the address because deterministic network. A user would see the address in the submitVAA tx log.
|
||||||
let wa = new WrappedAsset("0x79183957Be84C0F4dA451E534d5bA5BA3FB9c696");
|
let wa = new WrappedAsset("0x3c63250aFA2470359482d98749f2d60D2971c818");
|
||||||
assert.equal(await wa.assetChain(), 1)
|
assert.equal(await wa.assetChain(), 1)
|
||||||
// Remote asset's contract address.
|
// Remote asset's contract address.
|
||||||
assert.equal(await wa.assetAddress(), "0x0000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e9988")
|
assert.equal(await wa.assetAddress(), "0x0000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e9988")
|
||||||
// Account that the user requests the transfer to.
|
// Account that the user requests the transfer to.
|
||||||
let balance = await wa.balanceOf("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1");
|
let balance = await wa.balanceOf("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1");
|
||||||
assert.equal(balance, "5000000000000000000");
|
assert.equal(balance, "1000000000000000000");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not accept the same VAA twice", async function () {
|
it("should not accept the same VAA twice", async function () {
|
||||||
let bridge = await Wormhole.deployed();
|
let bridge = await Wormhole.deployed();
|
||||||
try {
|
try {
|
||||||
await bridge.submitVAA("0x0100000000010092737a1504f3b3df8c93cb85c64a4860bb270e26026b6e37f095356a406f6af439c6b2e9775fa1c6669525f06edab033ba5d447308f4e3bdb33c0f361dc32ec3015f3700081087000000350102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e99880000000000000000000000000000000000000000000000004563918244f40000");
|
await bridge.submitVAA("0x01000000000100eecb367540286d326e333ea06542b82d3feaeb0dc33b1b14bda8cdf8287da2a630a9a6692112bcedee501c0947c607081d51426fa1982ef342c07f4502b584c801000007d010000000380102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e99880000000000000000000000000000000000000000000000000de0b6b3a7640000");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assert.equal(e.reason, "VAA was already executed")
|
assert.equal(e.reason, "VAA was already executed")
|
||||||
return
|
return
|
||||||
|
@ -83,13 +82,13 @@ contract("Wormhole", function () {
|
||||||
it("should burn tokens on lock", async function () {
|
it("should burn tokens on lock", async function () {
|
||||||
let bridge = await Wormhole.deployed();
|
let bridge = await Wormhole.deployed();
|
||||||
// Expect user to have a balance
|
// Expect user to have a balance
|
||||||
let wa = new WrappedAsset("0x79183957Be84C0F4dA451E534d5bA5BA3FB9c696")
|
let wa = new WrappedAsset("0x3c63250aFA2470359482d98749f2d60D2971c818")
|
||||||
|
|
||||||
await bridge.lockAssets(wa.address, "4000000000000000000", "0x0", 2);
|
await bridge.lockAssets(wa.address, "500000000000000000", "0x0", 2);
|
||||||
let balance = await wa.balanceOf("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1");
|
let balance = await wa.balanceOf("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1");
|
||||||
|
|
||||||
// Expect user balance to decrease
|
// Expect user balance to decrease
|
||||||
assert.equal(balance, "1000000000000000000");
|
assert.equal(balance, "500000000000000000");
|
||||||
|
|
||||||
// Expect contract balance to be 0 since tokens have been burned
|
// Expect contract balance to be 0 since tokens have been burned
|
||||||
balance = await wa.balanceOf(bridge.address);
|
balance = await wa.balanceOf(bridge.address);
|
||||||
|
@ -110,7 +109,7 @@ contract("Wormhole", function () {
|
||||||
// Transfer of that token out of the contract should not work
|
// Transfer of that token out of the contract should not work
|
||||||
let threw = false;
|
let threw = false;
|
||||||
try {
|
try {
|
||||||
await bridge.submitVAA("0x01000000000100f0c5e4e6087c6af17ce51d6e51842a766834e252266fcccd9ad39222a262af4725ff3cd3d954fca7b9964c09f0290dfacefdcaa441f62b5128ec10dce888c0cc005f37017a1087000000350102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1020000000000000000000000009561c133dd8580860b6b7e504bc5aa500f0f06a70000000000000000000000000000000000000000000000000de0b6b3a7640000");
|
await bridge.submitVAA("0x01000000000100e2d8610a6cf10587ba2e4f43dc639eeacd3fb4297338955b00b7653094278082505de82418b9e0925d9dd889d0850252aa7c613e63c8b2c27ff22c0001c6336600000007d010000000380102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c102000000000000000000000000d833215cbcc3f914bd1c9ece3ee7bf8b14f841bb0000000000000000000000000000000000000000000000000de0b6b3a7640000");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
threw = true;
|
threw = true;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +123,7 @@ contract("Wormhole", function () {
|
||||||
assert.equal(ev.logs[0].event, "LogTokensLocked")
|
assert.equal(ev.logs[0].event, "LogTokensLocked")
|
||||||
assert.equal(ev.logs[0].args.target_chain, "3")
|
assert.equal(ev.logs[0].args.target_chain, "3")
|
||||||
assert.equal(ev.logs[0].args.token_chain, "2")
|
assert.equal(ev.logs[0].args.token_chain, "2")
|
||||||
assert.equal(ev.logs[0].args.token, "0x0000000000000000000000009561c133dd8580860b6b7e504bc5aa500f0f06a7")
|
assert.equal(ev.logs[0].args.token, "0x000000000000000000000000d833215cbcc3f914bd1c9ece3ee7bf8b14f841bb")
|
||||||
assert.equal(ev.logs[0].args.sender, "0x00000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1")
|
assert.equal(ev.logs[0].args.sender, "0x00000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1")
|
||||||
assert.equal(ev.logs[0].args.recipient, "0x1230000000000000000000000000000000000000000000000000000000000000")
|
assert.equal(ev.logs[0].args.recipient, "0x1230000000000000000000000000000000000000000000000000000000000000")
|
||||||
assert.equal(ev.logs[0].args.amount, "1000000000000000000")
|
assert.equal(ev.logs[0].args.amount, "1000000000000000000")
|
||||||
|
@ -134,7 +133,7 @@ contract("Wormhole", function () {
|
||||||
assert.equal(await token.balanceOf(bridge.address), "1000000000000000000");
|
assert.equal(await token.balanceOf(bridge.address), "1000000000000000000");
|
||||||
|
|
||||||
// Transfer this token back
|
// Transfer this token back
|
||||||
await bridge.submitVAA("0x01000000000100f0c5e4e6087c6af17ce51d6e51842a766834e252266fcccd9ad39222a262af4725ff3cd3d954fca7b9964c09f0290dfacefdcaa441f62b5128ec10dce888c0cc005f37017a1087000000350102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1020000000000000000000000009561c133dd8580860b6b7e504bc5aa500f0f06a70000000000000000000000000000000000000000000000000de0b6b3a7640000");
|
await bridge.submitVAA("0x01000000000100e2d8610a6cf10587ba2e4f43dc639eeacd3fb4297338955b00b7653094278082505de82418b9e0925d9dd889d0850252aa7c613e63c8b2c27ff22c0001c6336600000007d010000000380102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c102000000000000000000000000d833215cbcc3f914bd1c9ece3ee7bf8b14f841bb0000000000000000000000000000000000000000000000000de0b6b3a7640000");
|
||||||
assert.equal(await token.balanceOf("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1"), "1000000000000000000");
|
assert.equal(await token.balanceOf("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1"), "1000000000000000000");
|
||||||
assert.equal(await token.balanceOf(bridge.address), "0");
|
assert.equal(await token.balanceOf(bridge.address), "0");
|
||||||
});
|
});
|
||||||
|
@ -144,7 +143,7 @@ contract("Wormhole", function () {
|
||||||
|
|
||||||
// Push time by 1000
|
// Push time by 1000
|
||||||
await advanceTimeAndBlock(1000);
|
await advanceTimeAndBlock(1000);
|
||||||
let ev = await bridge.submitVAA("0x010000000001003382c71a4c79e1518a6ce29c91569f6427a60a95696a3515b8c2340b6acffd723315bd1011aa779f22573882a4edfe1b8206548e134871a23f8ba0c1c7d0b5ed0100000bb801190000000101befa429d57cd18b7f8a4d91a2da9ab4af05d0fbe")
|
let ev = await bridge.submitVAA("0x01000000000100a33c022217ccb87a5bc83b71e6377fff6639e7904d9e9995a42dc0867dc2b0bc5d1aacc3752ea71cf4d85278526b5dd40b0343667a2d4434a44cbf7844181a1000000007d0010000000101e06a9adfeb38a8ee4d00e89307c016d0749679bd")
|
||||||
assert.lengthOf(ev.logs, 1)
|
assert.lengthOf(ev.logs, 1)
|
||||||
assert.equal(ev.logs[0].event, "LogGuardianSetChanged")
|
assert.equal(ev.logs[0].event, "LogGuardianSetChanged")
|
||||||
|
|
||||||
|
@ -158,7 +157,7 @@ contract("Wormhole", function () {
|
||||||
// Test update guardian set VAA from guardian set 0; timestamp 2000
|
// Test update guardian set VAA from guardian set 0; timestamp 2000
|
||||||
let threw = false;
|
let threw = false;
|
||||||
try {
|
try {
|
||||||
await bridge.submitVAA("0x01000000000100686c37a81f0895d0db88c5c348bba8df53dedd579116327c999dc0229157c04e0304f9f8223b4e7b538ccf140de112d456d88e040bce025c1022bb840acb88390100000bb801190000000201befa429d57cd18b7f8a4d91a2da9ab4af05d0fbe")
|
await bridge.submitVAA("0x01000000000100d90d6f9cbc0458599cbe4d267bc9221b54955b94cb5cb338aeb845bdc9dd275f558871ea479de9cc0b44cfb2a07344431a3adbd2f98aa86f4e12ff4aba061b7f00000007d00100000001018575df9b3c97b4e267deb92d93137844a97a0132")
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
threw = true;
|
threw = true;
|
||||||
assert.equal(e.reason, "only the current guardian set can change the guardian set")
|
assert.equal(e.reason, "only the current guardian set can change the guardian set")
|
||||||
|
@ -170,14 +169,14 @@ contract("Wormhole", function () {
|
||||||
let bridge = await Wormhole.deployed();
|
let bridge = await Wormhole.deployed();
|
||||||
|
|
||||||
// Test VAA from guardian set 0; timestamp 1000
|
// Test VAA from guardian set 0; timestamp 1000
|
||||||
await bridge.submitVAA("0x01000000000100a60fd865ceee4cf34048fec8edc540f257d05c186d1ac6904d959d35ab2b6c0518feeb01fc3927b44d92746461d0ddb5ea0008de529b8a4862e18acf1fea364c00000003e81087000000360102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000009561c133dd8580860b6b7e504bc5aa500f0f06a70000000000000000000000000000000000000000000000000de0b6b3a7640000")
|
await bridge.submitVAA("0x0100000000010000b61ecc7b9de12de6fc7f01d8a89f8c2911329e44198d0a47768344c69eadd510fd5ab6474a24aa11a6751465fb4e2f8c81a4dbc2fc2427b4c5a981e8e63ed900000003e810000000380102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e99880000000000000000000000000000000000000000000000000de0b6b3a7640000")
|
||||||
|
|
||||||
await advanceTimeAndBlock(1000);
|
await advanceTimeAndBlock(1000);
|
||||||
|
|
||||||
// Test VAA from guardian set 0; timestamp 2000 - should not work anymore
|
// Test VAA from guardian set 0; timestamp 2000 - should not work anymore
|
||||||
let threw = false;
|
let threw = false;
|
||||||
try {
|
try {
|
||||||
await bridge.submitVAA("0x010000000001002a17cefb8242bc6865d3e38abd764359fcb4cb774637d483aa8690a223b334217e75d1e808dcc6999fa73fabdf20d28455fe4c3abcf565db351456df418f0b7900000007d01087000000360102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000009561c133dd8580860b6b7e504bc5aa500f0f06a70000000000000000000000000000000000000000000000000de0b6b3a7640000")
|
await bridge.submitVAA("0x01000000000100b7e82826980fb9f2389a6e22f7db12d5872e7900775c2c5d6ad1c3558ee7a1314f0f7f171cad73caaac0599c8914009ea9d0ef0e416404b141f844b85a5d254701000007d010000000380102020105000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e99880000000000000000000000000000000000000000000000000de0b6b3a7640000")
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
threw = true;
|
threw = true;
|
||||||
assert.equal(e.reason, "guardian set has expired")
|
assert.equal(e.reason, "guardian set has expired")
|
||||||
|
@ -185,7 +184,7 @@ contract("Wormhole", function () {
|
||||||
assert.isTrue(threw, "guardian set did not expire")
|
assert.isTrue(threw, "guardian set did not expire")
|
||||||
|
|
||||||
// Test same transaction with guardian set 1; timestamp 2000
|
// Test same transaction with guardian set 1; timestamp 2000
|
||||||
await bridge.submitVAA("0x010000000101005cae5dc08ebab209640fb5b8051261a5cff25bd84a69f93ec36a4106fde6a53e7275267596a4833607aae8ae9426b7bd10d8062f06c96dc9c820e30516e32e0400000007d01087000000350102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000009561c133dd8580860b6b7e504bc5aa500f0f06a70000000000000000000000000000000000000000000000000de0b6b3a7640000")
|
await bridge.submitVAA("0x01000000010100a3f58fb72b3c7e242d6934718eafb3076cb0764e65d8df3e0746b0c72cca791027ac649fa0095a1c3537611f4adc0dc90aaa01fce31fac722eae898cfb06e96d01000007d010000000380102020105000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e99880000000000000000000000000000000000000000000000000de0b6b3a7640000")
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should expire VAA", async function () {
|
it("should expire VAA", async function () {
|
||||||
|
@ -224,12 +223,12 @@ contract("Wormhole", function () {
|
||||||
let bridge = await Wormhole.deployed();
|
let bridge = await Wormhole.deployed();
|
||||||
|
|
||||||
// Update to validator set 2 with 6 signers
|
// Update to validator set 2 with 6 signers
|
||||||
await bridge.submitVAA("0x010000000101006ec1d2ab1b9c24fecfc43265366038ea06d465c422cb92348d757436846fe908068e92d0bdca740c583a717da7cd525e46d80b0b945a51baae72007e456b8a240100001388017d00000002067e5f4552091a69125d5dfcb7b8c2659029395bdfbefa429d57cd18b7f8a4d91a2da9ab4af05d0fbebefa429d57cd18b7f8a4d91a2da9ab4af05d0fbebefa429d57cd18b7f8a4d91a2da9ab4af05d0fbebefa429d57cd18b7f8a4d91a2da9ab4af05d0fbebefa429d57cd18b7f8a4d91a2da9ab4af05d0fbe")
|
await bridge.submitVAA("0x010000000101007a8681fbb4eb93fe71d2608bacdd6ac8d7f07987d531435fc4e0e9224fcf5d087991860eb61b73671db864e7b33894ec82f7ffb17ba5a888712fb6be11df4b030100000fa0010000000206befa429d57cd18b7f8a4d91a2da9ab4af05d0fbee06a9adfeb38a8ee4d00e89307c016d0749679bd8575df9b3c97b4e267deb92d93137844a97a01320427cda59902dc6eb0c1bd2b6d38f87c5552b348bfea822f75c42e1764c791b8fe04a7b10ddb38572f5fe0b158147e7260f14062556afc94eece55ff")
|
||||||
|
|
||||||
// Test VAA signed by only 3 signers
|
// Test VAA signed by only 3 signers
|
||||||
let threw = false;
|
let threw = false;
|
||||||
try {
|
try {
|
||||||
await bridge.submitVAA("0x01000000020300d943f7e2f94fdb2d23d8ce270c1b981ce8058a94c46358e4fb486f9b80c685d234fe7fee41c054c5ed5aa26548e39bc23875549e72100b02aabe1e9bd4c7d9b601018ce763f32e07d8d2d69907575425ad9ffbda4be1917a64ea2f90172ae8212e2c2c04917956ab5a72b6ef4642f1673e28465567de3ad3197d1a773e28c03c40c100028ce763f32e07d8d2d69907575425ad9ffbda4be1917a64ea2f90172ae8212e2c2c04917956ab5a72b6ef4642f1673e28465567de3ad3197d1a773e28c03c40c10000000fa01087000000380102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000009561c133dd8580860b6b7e504bc5aa500f0f06a70000000000000000000000000000000000000000000000000de0b6b3a7640000")
|
await bridge.submitVAA("0x010000000203001dbccdb06c91929042b20a136d226890e22b07120d2854aa5c17bc1cce934cf66e2f5e31a3d883bc928346c35352a7627fb0aa7e420b73a89dc0c205780f98bc0001eadd27047cb0988ed4a7c681af758e88c628f2a3c424186044e3fd9ad8c3425f401bfc29674db720f62f08a251ff6aa3b982adb57186422cdad03cc4bfc07bb001020193d92acf2ecadad96273f122ada995700225c18d65db636db7f52e2c77906e3e0153a163c4d123b68f78cc1a8c5dbd4bdf1a26718cfc850c8278ec4a39bb470100000fa010000000390102020105000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e99880000000000000000000000000000000000000000000000000de0b6b3a7640000")
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
threw = true;
|
threw = true;
|
||||||
assert.equal(e.reason, "no quorum")
|
assert.equal(e.reason, "no quorum")
|
||||||
|
@ -237,6 +236,6 @@ contract("Wormhole", function () {
|
||||||
assert.isTrue(threw, "accepted only 3 signatures")
|
assert.isTrue(threw, "accepted only 3 signatures")
|
||||||
|
|
||||||
// Test VAA signed by 5 signers (all except i=3)
|
// Test VAA signed by 5 signers (all except i=3)
|
||||||
await bridge.submitVAA("0x01000000020500d943f7e2f94fdb2d23d8ce270c1b981ce8058a94c46358e4fb486f9b80c685d234fe7fee41c054c5ed5aa26548e39bc23875549e72100b02aabe1e9bd4c7d9b601018ce763f32e07d8d2d69907575425ad9ffbda4be1917a64ea2f90172ae8212e2c2c04917956ab5a72b6ef4642f1673e28465567de3ad3197d1a773e28c03c40c100028ce763f32e07d8d2d69907575425ad9ffbda4be1917a64ea2f90172ae8212e2c2c04917956ab5a72b6ef4642f1673e28465567de3ad3197d1a773e28c03c40c100048ce763f32e07d8d2d69907575425ad9ffbda4be1917a64ea2f90172ae8212e2c2c04917956ab5a72b6ef4642f1673e28465567de3ad3197d1a773e28c03c40c100058ce763f32e07d8d2d69907575425ad9ffbda4be1917a64ea2f90172ae8212e2c2c04917956ab5a72b6ef4642f1673e28465567de3ad3197d1a773e28c03c40c10000000fa01087000000380102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000009561c133dd8580860b6b7e504bc5aa500f0f06a70000000000000000000000000000000000000000000000000de0b6b3a7640000")
|
await bridge.submitVAA("0x010000000205001dbccdb06c91929042b20a136d226890e22b07120d2854aa5c17bc1cce934cf66e2f5e31a3d883bc928346c35352a7627fb0aa7e420b73a89dc0c205780f98bc0001eadd27047cb0988ed4a7c681af758e88c628f2a3c424186044e3fd9ad8c3425f401bfc29674db720f62f08a251ff6aa3b982adb57186422cdad03cc4bfc07bb0010393f4821a0fc8248ad8eccfb6e1b6a1fb70d0294a6a2b53cb6e222205f3d9f960491fdda4e23e2dde46b084f4ac101050deecbe871eeec218217037d7974b41a301049571b8d3fbcebad1e868331570120a27cf122d33f3d5b95355fde3712ecdbd5233888ec51e5d9e960beaa9a0697f5ac69f9deae37782b874fbe8aecf064087e00105ddd37a55e2a654f5898b1863eaf8efa464797bfa602893d0bcbcc06269df6a3b4ba88c01f3ad22d23a02c8dc1cb34d28b6eb4dd3e2030b8b42ff6909537faf430000000fa010000000390102020105000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e99880000000000000000000000000000000000000000000000000de0b6b3a7640000")
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -108,7 +108,6 @@ impl VAA {
|
||||||
v.write_u8(payload.action_id())?;
|
v.write_u8(payload.action_id())?;
|
||||||
|
|
||||||
let payload_data = payload.serialize()?;
|
let payload_data = payload.serialize()?;
|
||||||
v.write_u8(payload_data.len() as u8)?;
|
|
||||||
v.write(payload_data.as_slice())?;
|
v.write(payload_data.as_slice())?;
|
||||||
|
|
||||||
Ok(v.into_inner())
|
Ok(v.into_inner())
|
||||||
|
@ -177,7 +176,6 @@ impl VAABody {
|
||||||
fn deserialize(data: &Vec<u8>) -> Result<VAABody, Error> {
|
fn deserialize(data: &Vec<u8>) -> Result<VAABody, Error> {
|
||||||
let mut payload_data = Cursor::new(data);
|
let mut payload_data = Cursor::new(data);
|
||||||
let action = payload_data.read_u8()?;
|
let action = payload_data.read_u8()?;
|
||||||
let _length = payload_data.read_u8()?;
|
|
||||||
|
|
||||||
let payload = match action {
|
let payload = match action {
|
||||||
0x01 => {
|
0x01 => {
|
||||||
|
@ -385,7 +383,7 @@ mod tests {
|
||||||
]],
|
]],
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
let data = hex::decode("010000000001003382c71a4c79e1518a6ce29c91569f6427a60a95696a3515b8c2340b6acffd723315bd1011aa779f22573882a4edfe1b8206548e134871a23f8ba0c1c7d0b5ed0100000bb801190000000101befa429d57cd18b7f8a4d91a2da9ab4af05d0fbe").unwrap();
|
let data = hex::decode("010000000001003382c71a4c79e1518a6ce29c91569f6427a60a95696a3515b8c2340b6acffd723315bd1011aa779f22573882a4edfe1b8206548e134871a23f8ba0c1c7d0b5ed0100000bb8010000000101befa429d57cd18b7f8a4d91a2da9ab4af05d0fbe").unwrap();
|
||||||
let parsed_vaa = VAA::deserialize(data.as_slice()).unwrap();
|
let parsed_vaa = VAA::deserialize(data.as_slice()).unwrap();
|
||||||
assert_eq!(vaa, parsed_vaa);
|
assert_eq!(vaa, parsed_vaa);
|
||||||
|
|
||||||
|
@ -433,7 +431,7 @@ mod tests {
|
||||||
amount: U256::from_dec_str("5000000000000000000").unwrap(),
|
amount: U256::from_dec_str("5000000000000000000").unwrap(),
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
let data = hex::decode("0100000000010092737a1504f3b3df8c93cb85c64a4860bb270e26026b6e37f095356a406f6af439c6b2e9775fa1c6669525f06edab033ba5d447308f4e3bdb33c0f361dc32ec3015f3700081087000000350102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e99880000000000000000000000000000000000000000000000004563918244f40000").unwrap();
|
let data = hex::decode("0100000000010092737a1504f3b3df8c93cb85c64a4860bb270e26026b6e37f095356a406f6af439c6b2e9775fa1c6669525f06edab033ba5d447308f4e3bdb33c0f361dc32ec3015f37000810000000350102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e99880000000000000000000000000000000000000000000000004563918244f40000").unwrap();
|
||||||
let parsed_vaa = VAA::deserialize(data.as_slice()).unwrap();
|
let parsed_vaa = VAA::deserialize(data.as_slice()).unwrap();
|
||||||
assert_eq!(vaa, parsed_vaa);
|
assert_eq!(vaa, parsed_vaa);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue