bridge: remove VAA timeout

Closes #35
This commit is contained in:
Hendrik Hofstadt 2020-08-28 08:49:46 +02:00
parent ed0a6d4b2e
commit 8e6dc495dc
9 changed files with 1365 additions and 138 deletions

View File

@ -20,6 +20,7 @@ var (
_ = big.NewInt
_ = strings.NewReader
_ = ethereum.NotFound
_ = abi.U256
_ = bind.Bind
_ = common.Big1
_ = types.BloomLookup
@ -33,7 +34,7 @@ type WormholeGuardianSet struct {
}
// AbiABI is the input ABI used to generate the binding from.
const AbiABI = "[{\"inputs\":[{\"components\":[{\"internalType\":\"address[]\",\"name\":\"keys\",\"type\":\"address[]\"},{\"internalType\":\"uint32\",\"name\":\"expiration_time\",\"type\":\"uint32\"}],\"internalType\":\"structWormhole.GuardianSet\",\"name\":\"initial_guardian_set\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"wrapped_asset_master\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"_vaa_expiry\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"oldGuardianIndex\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newGuardianIndex\",\"type\":\"uint32\"}],\"name\":\"LogGuardianSetChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"target_chain\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"token_chain\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"token\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"sender\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"recipient\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"}],\"name\":\"LogTokensLocked\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\",\"payable\":true},{\"inputs\":[],\"name\":\"guardian_set_index\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\",\"constant\":true},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"guardian_sets\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"expiration_time\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\",\"constant\":true},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isWrappedAsset\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\",\"constant\":true},{\"inputs\":[],\"name\":\"vaa_expiry\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\",\"constant\":true},{\"inputs\":[],\"name\":\"wrappedAssetMaster\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\",\"constant\":true},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"wrappedAssets\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\",\"constant\":true},{\"stateMutability\":\"payable\",\"type\":\"receive\",\"payable\":true},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"idx\",\"type\":\"uint32\"}],\"name\":\"getGuardianSet\",\"outputs\":[{\"components\":[{\"internalType\":\"address[]\",\"name\":\"keys\",\"type\":\"address[]\"},{\"internalType\":\"uint32\",\"name\":\"expiration_time\",\"type\":\"uint32\"}],\"internalType\":\"structWormhole.GuardianSet\",\"name\":\"gs\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\",\"constant\":true},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"vaa\",\"type\":\"bytes\"}],\"name\":\"submitVAA\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"recipient\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"target_chain\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"}],\"name\":\"lockAssets\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"recipient\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"target_chain\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"}],\"name\":\"lockETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\",\"payable\":true}]"
const AbiABI = "[{\"inputs\":[{\"components\":[{\"internalType\":\"address[]\",\"name\":\"keys\",\"type\":\"address[]\"},{\"internalType\":\"uint32\",\"name\":\"expiration_time\",\"type\":\"uint32\"}],\"internalType\":\"structWormhole.GuardianSet\",\"name\":\"initial_guardian_set\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"wrapped_asset_master\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"_guardian_set_expirity\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"oldGuardianIndex\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newGuardianIndex\",\"type\":\"uint32\"}],\"name\":\"LogGuardianSetChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"target_chain\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"token_chain\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"token\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"sender\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"recipient\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"}],\"name\":\"LogTokensLocked\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"guardian_set_expirity\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"guardian_set_index\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"guardian_sets\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"expiration_time\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isWrappedAsset\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wrappedAssetMaster\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"wrappedAssets\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"idx\",\"type\":\"uint32\"}],\"name\":\"getGuardianSet\",\"outputs\":[{\"components\":[{\"internalType\":\"address[]\",\"name\":\"keys\",\"type\":\"address[]\"},{\"internalType\":\"uint32\",\"name\":\"expiration_time\",\"type\":\"uint32\"}],\"internalType\":\"structWormhole.GuardianSet\",\"name\":\"gs\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"vaa\",\"type\":\"bytes\"}],\"name\":\"submitVAA\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"recipient\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"target_chain\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"}],\"name\":\"lockAssets\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"recipient\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"target_chain\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"}],\"name\":\"lockETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]"
// Abi is an auto generated Go binding around an Ethereum contract.
type Abi struct {
@ -179,7 +180,7 @@ func (_Abi *AbiTransactorRaw) Transact(opts *bind.TransactOpts, method string, p
// GetGuardianSet is a free data retrieval call binding the contract method 0xf951975a.
//
// Solidity: function getGuardianSet(uint32 idx) view returns((address[],uint32) gs)
// Solidity: function getGuardianSet(uint32 idx) constant returns(WormholeGuardianSet gs)
func (_Abi *AbiCaller) GetGuardianSet(opts *bind.CallOpts, idx uint32) (WormholeGuardianSet, error) {
var (
ret0 = new(WormholeGuardianSet)
@ -191,21 +192,47 @@ func (_Abi *AbiCaller) GetGuardianSet(opts *bind.CallOpts, idx uint32) (Wormhole
// GetGuardianSet is a free data retrieval call binding the contract method 0xf951975a.
//
// Solidity: function getGuardianSet(uint32 idx) view returns((address[],uint32) gs)
// Solidity: function getGuardianSet(uint32 idx) constant returns(WormholeGuardianSet gs)
func (_Abi *AbiSession) GetGuardianSet(idx uint32) (WormholeGuardianSet, error) {
return _Abi.Contract.GetGuardianSet(&_Abi.CallOpts, idx)
}
// GetGuardianSet is a free data retrieval call binding the contract method 0xf951975a.
//
// Solidity: function getGuardianSet(uint32 idx) view returns((address[],uint32) gs)
// Solidity: function getGuardianSet(uint32 idx) constant returns(WormholeGuardianSet gs)
func (_Abi *AbiCallerSession) GetGuardianSet(idx uint32) (WormholeGuardianSet, error) {
return _Abi.Contract.GetGuardianSet(&_Abi.CallOpts, idx)
}
// GuardianSetExpirity is a free data retrieval call binding the contract method 0x4db47840.
//
// Solidity: function guardian_set_expirity() constant returns(uint32)
func (_Abi *AbiCaller) GuardianSetExpirity(opts *bind.CallOpts) (uint32, error) {
var (
ret0 = new(uint32)
)
out := ret0
err := _Abi.contract.Call(opts, out, "guardian_set_expirity")
return *ret0, err
}
// GuardianSetExpirity is a free data retrieval call binding the contract method 0x4db47840.
//
// Solidity: function guardian_set_expirity() constant returns(uint32)
func (_Abi *AbiSession) GuardianSetExpirity() (uint32, error) {
return _Abi.Contract.GuardianSetExpirity(&_Abi.CallOpts)
}
// GuardianSetExpirity is a free data retrieval call binding the contract method 0x4db47840.
//
// Solidity: function guardian_set_expirity() constant returns(uint32)
func (_Abi *AbiCallerSession) GuardianSetExpirity() (uint32, error) {
return _Abi.Contract.GuardianSetExpirity(&_Abi.CallOpts)
}
// GuardianSetIndex is a free data retrieval call binding the contract method 0x822d82b3.
//
// Solidity: function guardian_set_index() view returns(uint32)
// Solidity: function guardian_set_index() constant returns(uint32)
func (_Abi *AbiCaller) GuardianSetIndex(opts *bind.CallOpts) (uint32, error) {
var (
ret0 = new(uint32)
@ -217,21 +244,21 @@ func (_Abi *AbiCaller) GuardianSetIndex(opts *bind.CallOpts) (uint32, error) {
// GuardianSetIndex is a free data retrieval call binding the contract method 0x822d82b3.
//
// Solidity: function guardian_set_index() view returns(uint32)
// Solidity: function guardian_set_index() constant returns(uint32)
func (_Abi *AbiSession) GuardianSetIndex() (uint32, error) {
return _Abi.Contract.GuardianSetIndex(&_Abi.CallOpts)
}
// GuardianSetIndex is a free data retrieval call binding the contract method 0x822d82b3.
//
// Solidity: function guardian_set_index() view returns(uint32)
// Solidity: function guardian_set_index() constant returns(uint32)
func (_Abi *AbiCallerSession) GuardianSetIndex() (uint32, error) {
return _Abi.Contract.GuardianSetIndex(&_Abi.CallOpts)
}
// GuardianSets is a free data retrieval call binding the contract method 0x42b0aefa.
//
// Solidity: function guardian_sets(uint32 ) view returns(uint32 expiration_time)
// Solidity: function guardian_sets(uint32 ) constant returns(uint32 expiration_time)
func (_Abi *AbiCaller) GuardianSets(opts *bind.CallOpts, arg0 uint32) (uint32, error) {
var (
ret0 = new(uint32)
@ -243,21 +270,21 @@ func (_Abi *AbiCaller) GuardianSets(opts *bind.CallOpts, arg0 uint32) (uint32, e
// GuardianSets is a free data retrieval call binding the contract method 0x42b0aefa.
//
// Solidity: function guardian_sets(uint32 ) view returns(uint32 expiration_time)
// Solidity: function guardian_sets(uint32 ) constant returns(uint32 expiration_time)
func (_Abi *AbiSession) GuardianSets(arg0 uint32) (uint32, error) {
return _Abi.Contract.GuardianSets(&_Abi.CallOpts, arg0)
}
// GuardianSets is a free data retrieval call binding the contract method 0x42b0aefa.
//
// Solidity: function guardian_sets(uint32 ) view returns(uint32 expiration_time)
// Solidity: function guardian_sets(uint32 ) constant returns(uint32 expiration_time)
func (_Abi *AbiCallerSession) GuardianSets(arg0 uint32) (uint32, error) {
return _Abi.Contract.GuardianSets(&_Abi.CallOpts, arg0)
}
// IsWrappedAsset is a free data retrieval call binding the contract method 0x1a2be4da.
//
// Solidity: function isWrappedAsset(address ) view returns(bool)
// Solidity: function isWrappedAsset(address ) constant returns(bool)
func (_Abi *AbiCaller) IsWrappedAsset(opts *bind.CallOpts, arg0 common.Address) (bool, error) {
var (
ret0 = new(bool)
@ -269,47 +296,21 @@ func (_Abi *AbiCaller) IsWrappedAsset(opts *bind.CallOpts, arg0 common.Address)
// IsWrappedAsset is a free data retrieval call binding the contract method 0x1a2be4da.
//
// Solidity: function isWrappedAsset(address ) view returns(bool)
// Solidity: function isWrappedAsset(address ) constant returns(bool)
func (_Abi *AbiSession) IsWrappedAsset(arg0 common.Address) (bool, error) {
return _Abi.Contract.IsWrappedAsset(&_Abi.CallOpts, arg0)
}
// IsWrappedAsset is a free data retrieval call binding the contract method 0x1a2be4da.
//
// Solidity: function isWrappedAsset(address ) view returns(bool)
// Solidity: function isWrappedAsset(address ) constant returns(bool)
func (_Abi *AbiCallerSession) IsWrappedAsset(arg0 common.Address) (bool, error) {
return _Abi.Contract.IsWrappedAsset(&_Abi.CallOpts, arg0)
}
// VaaExpiry is a free data retrieval call binding the contract method 0x7f04d9e6.
//
// Solidity: function vaa_expiry() view returns(uint32)
func (_Abi *AbiCaller) VaaExpiry(opts *bind.CallOpts) (uint32, error) {
var (
ret0 = new(uint32)
)
out := ret0
err := _Abi.contract.Call(opts, out, "vaa_expiry")
return *ret0, err
}
// VaaExpiry is a free data retrieval call binding the contract method 0x7f04d9e6.
//
// Solidity: function vaa_expiry() view returns(uint32)
func (_Abi *AbiSession) VaaExpiry() (uint32, error) {
return _Abi.Contract.VaaExpiry(&_Abi.CallOpts)
}
// VaaExpiry is a free data retrieval call binding the contract method 0x7f04d9e6.
//
// Solidity: function vaa_expiry() view returns(uint32)
func (_Abi *AbiCallerSession) VaaExpiry() (uint32, error) {
return _Abi.Contract.VaaExpiry(&_Abi.CallOpts)
}
// WrappedAssetMaster is a free data retrieval call binding the contract method 0x99da1d3c.
//
// Solidity: function wrappedAssetMaster() view returns(address)
// Solidity: function wrappedAssetMaster() constant returns(address)
func (_Abi *AbiCaller) WrappedAssetMaster(opts *bind.CallOpts) (common.Address, error) {
var (
ret0 = new(common.Address)
@ -321,21 +322,21 @@ func (_Abi *AbiCaller) WrappedAssetMaster(opts *bind.CallOpts) (common.Address,
// WrappedAssetMaster is a free data retrieval call binding the contract method 0x99da1d3c.
//
// Solidity: function wrappedAssetMaster() view returns(address)
// Solidity: function wrappedAssetMaster() constant returns(address)
func (_Abi *AbiSession) WrappedAssetMaster() (common.Address, error) {
return _Abi.Contract.WrappedAssetMaster(&_Abi.CallOpts)
}
// WrappedAssetMaster is a free data retrieval call binding the contract method 0x99da1d3c.
//
// Solidity: function wrappedAssetMaster() view returns(address)
// Solidity: function wrappedAssetMaster() constant returns(address)
func (_Abi *AbiCallerSession) WrappedAssetMaster() (common.Address, error) {
return _Abi.Contract.WrappedAssetMaster(&_Abi.CallOpts)
}
// WrappedAssets is a free data retrieval call binding the contract method 0xb6694c2a.
//
// Solidity: function wrappedAssets(bytes32 ) view returns(address)
// Solidity: function wrappedAssets(bytes32 ) constant returns(address)
func (_Abi *AbiCaller) WrappedAssets(opts *bind.CallOpts, arg0 [32]byte) (common.Address, error) {
var (
ret0 = new(common.Address)
@ -347,14 +348,14 @@ func (_Abi *AbiCaller) WrappedAssets(opts *bind.CallOpts, arg0 [32]byte) (common
// WrappedAssets is a free data retrieval call binding the contract method 0xb6694c2a.
//
// Solidity: function wrappedAssets(bytes32 ) view returns(address)
// Solidity: function wrappedAssets(bytes32 ) constant returns(address)
func (_Abi *AbiSession) WrappedAssets(arg0 [32]byte) (common.Address, error) {
return _Abi.Contract.WrappedAssets(&_Abi.CallOpts, arg0)
}
// WrappedAssets is a free data retrieval call binding the contract method 0xb6694c2a.
//
// Solidity: function wrappedAssets(bytes32 ) view returns(address)
// Solidity: function wrappedAssets(bytes32 ) constant returns(address)
func (_Abi *AbiCallerSession) WrappedAssets(arg0 [32]byte) (common.Address, error) {
return _Abi.Contract.WrappedAssets(&_Abi.CallOpts, arg0)
}
@ -382,21 +383,21 @@ func (_Abi *AbiTransactorSession) LockAssets(asset common.Address, amount *big.I
// LockETH is a paid mutator transaction binding the contract method 0x58d62e46.
//
// Solidity: function lockETH(bytes32 recipient, uint8 target_chain, uint32 nonce) payable returns()
// Solidity: function lockETH(bytes32 recipient, uint8 target_chain, uint32 nonce) returns()
func (_Abi *AbiTransactor) LockETH(opts *bind.TransactOpts, recipient [32]byte, target_chain uint8, nonce uint32) (*types.Transaction, error) {
return _Abi.contract.Transact(opts, "lockETH", recipient, target_chain, nonce)
}
// LockETH is a paid mutator transaction binding the contract method 0x58d62e46.
//
// Solidity: function lockETH(bytes32 recipient, uint8 target_chain, uint32 nonce) payable returns()
// Solidity: function lockETH(bytes32 recipient, uint8 target_chain, uint32 nonce) returns()
func (_Abi *AbiSession) LockETH(recipient [32]byte, target_chain uint8, nonce uint32) (*types.Transaction, error) {
return _Abi.Contract.LockETH(&_Abi.TransactOpts, recipient, target_chain, nonce)
}
// LockETH is a paid mutator transaction binding the contract method 0x58d62e46.
//
// Solidity: function lockETH(bytes32 recipient, uint8 target_chain, uint32 nonce) payable returns()
// Solidity: function lockETH(bytes32 recipient, uint8 target_chain, uint32 nonce) returns()
func (_Abi *AbiTransactorSession) LockETH(recipient [32]byte, target_chain uint8, nonce uint32) (*types.Transaction, error) {
return _Abi.Contract.LockETH(&_Abi.TransactOpts, recipient, target_chain, nonce)
}
@ -422,48 +423,6 @@ func (_Abi *AbiTransactorSession) SubmitVAA(vaa []byte) (*types.Transaction, err
return _Abi.Contract.SubmitVAA(&_Abi.TransactOpts, vaa)
}
// Fallback is a paid mutator transaction binding the contract fallback function.
//
// Solidity: fallback() payable returns()
func (_Abi *AbiTransactor) Fallback(opts *bind.TransactOpts, calldata []byte) (*types.Transaction, error) {
return _Abi.contract.RawTransact(opts, calldata)
}
// Fallback is a paid mutator transaction binding the contract fallback function.
//
// Solidity: fallback() payable returns()
func (_Abi *AbiSession) Fallback(calldata []byte) (*types.Transaction, error) {
return _Abi.Contract.Fallback(&_Abi.TransactOpts, calldata)
}
// Fallback is a paid mutator transaction binding the contract fallback function.
//
// Solidity: fallback() payable returns()
func (_Abi *AbiTransactorSession) Fallback(calldata []byte) (*types.Transaction, error) {
return _Abi.Contract.Fallback(&_Abi.TransactOpts, calldata)
}
// Receive is a paid mutator transaction binding the contract receive function.
//
// Solidity: receive() payable returns()
func (_Abi *AbiTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Abi.contract.RawTransact(opts, nil) // calldata is disallowed for receive function
}
// Receive is a paid mutator transaction binding the contract receive function.
//
// Solidity: receive() payable returns()
func (_Abi *AbiSession) Receive() (*types.Transaction, error) {
return _Abi.Contract.Receive(&_Abi.TransactOpts)
}
// Receive is a paid mutator transaction binding the contract receive function.
//
// Solidity: receive() payable returns()
func (_Abi *AbiTransactorSession) Receive() (*types.Transaction, error) {
return _Abi.Contract.Receive(&_Abi.TransactOpts)
}
// AbiLogGuardianSetChangedIterator is returned from FilterLogGuardianSetChanged and is used to iterate over the raw logs and unpacked data for LogGuardianSetChanged events raised by the Abi contract.
type AbiLogGuardianSetChangedIterator struct {
Event *AbiLogGuardianSetChanged // Event containing the contract specifics and raw log
@ -754,4 +713,3 @@ func (_Abi *AbiFilterer) ParseLogTokensLocked(log types.Log) (*AbiLogTokensLocke
}
return event, nil
}

View File

@ -52,8 +52,8 @@ contract Wormhole is ReentrancyGuard {
// Current active guardian set
uint32 public guardian_set_index;
// Period for which an vaa is valid in seconds
uint32 public vaa_expiry;
// Period for which a guardian set stays active after it has been replaced
uint32 public guardian_set_expirity;
// Mapping of already consumedVAAs
mapping(bytes32 => bool) consumedVAAs;
@ -62,11 +62,11 @@ contract Wormhole is ReentrancyGuard {
mapping(bytes32 => address) public wrappedAssets;
mapping(address => bool) public isWrappedAsset;
constructor(GuardianSet memory initial_guardian_set, address wrapped_asset_master, uint32 _vaa_expiry) public {
constructor(GuardianSet memory initial_guardian_set, address wrapped_asset_master, uint32 _guardian_set_expirity) public {
guardian_sets[0] = initial_guardian_set;
// Explicitly set for doc purposes
guardian_set_index = 0;
vaa_expiry = _vaa_expiry;
guardian_set_expirity = _guardian_set_expirity;
wrappedAssetMaster = wrapped_asset_master;
}
@ -90,9 +90,6 @@ contract Wormhole is ReentrancyGuard {
// Load 4 bytes timestamp
uint32 timestamp = vaa.toUint32(offset);
// Verify that the VAA is still valid
require(timestamp + vaa_expiry > block.timestamp, "VAA has expired");
// Hash the body
bytes32 hash = keccak256(vaa.slice(offset, vaa.length - offset));
require(!consumedVAAs[hash], "VAA was already executed");
@ -142,7 +139,7 @@ contract Wormhole is ReentrancyGuard {
GuardianSet memory new_guardian_set = GuardianSet(new_guardians, 0);
guardian_sets[guardian_set_index] = new_guardian_set;
guardian_sets[old_guardian_set_index].expiration_time = uint32(block.timestamp) + vaa_expiry;
guardian_sets[old_guardian_set_index].expiration_time = uint32(block.timestamp) + guardian_set_expirity;
emit LogGuardianSetChanged(old_guardian_set_index, guardian_set_index);
}

File diff suppressed because it is too large Load Diff

View File

@ -191,24 +191,6 @@ contract("Wormhole", function () {
await bridge.submitVAA("0x01000000010100a3f58fb72b3c7e242d6934718eafb3076cb0764e65d8df3e0746b0c72cca791027ac649fa0095a1c3537611f4adc0dc90aaa01fce31fac722eae898cfb06e96d01000007d010000000380102020105000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000000347ef34687bdc9f189e87a9200658d9c40e99880000000000000000000000000000000000000000000000000de0b6b3a7640000")
});
it("should expire VAA", async function () {
let bridge = await Wormhole.deployed();
// Push time by 1000
await advanceTimeAndBlock(1000);
// Test same transaction with guardian set 1; timestamp 2000
let threw = false;
try {
await bridge.submitVAA("0x01000000010100f69b3f6e31fbbe6ce9b9b1be8e8effded63b44ab8d7d2dc993c914d50d4bb6fe75cdf6ebb15e5bf209f2ea608e496283d8ff5a91a102f1cab42e9093cbb50b6201000007d01087000000360102020104000000000000000000000000000000000000000000000000000000000000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1010000000000000000000000009561c133dd8580860b6b7e504bc5aa500f0f06a70000000000000000000000000000000000000000000000000de0b6b3a7640000")
} catch (e) {
threw = true;
assert.equal(e.reason, "VAA has expired")
}
assert.isTrue(threw, "VAA did not expire")
});
it("mismatching guardian set and signature should not work", async function () {
let bridge = await Wormhole.deployed();

View File

@ -76,9 +76,6 @@ pub enum Error {
/// The guardian set that signed this VAA has expired
#[error("GuardianSetExpired")]
GuardianSetExpired,
/// The given VAA has expired
#[error("VAAExpired")]
VAAExpired,
/// The given VAA has already been claimed
#[error("VAAClaimed")]
VAAClaimed,

View File

@ -28,7 +28,6 @@ impl PrintProgramError for Error {
Error::WrongTokenAccountOwner => info!("Error: WrongTokenAccountOwner"),
Error::ParseFailed => info!("Error: ParseFailed"),
Error::GuardianSetExpired => info!("Error: GuardianSetExpired"),
Error::VAAExpired => info!("Error: VAAExpired"),
Error::VAAClaimed => info!("Error: VAAClaimed"),
Error::WrongBridgeOwner => info!("Error: WrongBridgeOwner"),
Error::OldGuardianSet => info!("Error: OldGuardianSet"),

View File

@ -425,13 +425,6 @@ impl Bridge {
return Err(Error::GuardianSetExpired.into());
}
// Check that the VAA is still valid
if (guardian_set.expiration_time as i64) + (bridge.config.vaa_expiration_time as i64)
> clock.unix_timestamp
{
return Err(Error::VAAExpired.into());
}
// Verify VAA signature
if !vaa.verify(&guardian_set.keys[..guardian_set.len_keys as usize]) {
return Err(Error::InvalidVAASignature.into());
@ -515,9 +508,8 @@ impl Bridge {
}
// Set the exirity on the old guardian set
// The guardian set will expire once all currently issues vaas have expired
old_guardian_set.expiration_time =
(clock.unix_timestamp as u32) + bridge.config.vaa_expiration_time;
(clock.unix_timestamp as u32) + bridge.config.guardian_set_expiration_time;
// Check whether the new guardian set was derived correctly
let guardian_seed = Bridge::derive_guardian_set_seeds(bridge_info.key, b.new_index);

View File

@ -142,10 +142,10 @@ pub struct AssetMeta {
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct BridgeConfig {
/// Period for how long a VAA is valid. This is also the period after a valid VAA has been
/// published to a `TransferOutProposal` or `ClaimedVAA` after which the account can be evicted.
/// This exists to guarantee data availability and prevent replays.
pub vaa_expiration_time: u32,
/// Period for how long a guardian set is valid after it has been replaced by a new one.
/// This guarantees that VAAs issued by that set can still be submitted for a certain period.
/// In this period we still trust the old guardian set.
pub guardian_set_expiration_time: u32,
/// Token program that is used for this bridge
pub token_program: Pubkey,

View File

@ -68,7 +68,7 @@ fn command_deploy_bridge(
&config.owner.pubkey(),
initial_guardian,
&BridgeConfig {
vaa_expiration_time: 200000000,
guardian_set_expiration_time: 200000000,
token_program: spl_token::id(),
},
)?;