diff --git a/clients/nft_bridge/main.ts b/clients/nft_bridge/main.ts index 9fe725dfb..b330edbbf 100644 --- a/clients/nft_bridge/main.ts +++ b/clients/nft_bridge/main.ts @@ -110,6 +110,48 @@ yargs(hideBin(process.argv)) console.log(vm) }) + .command('generate_upgrade_chain_vaa [chain_id] [contract_address]', 'create a VAA to upgrade a chain (debug-only)', (yargs) => { + return yargs + .positional('chain_id', { + describe: 'chain id to upgrade', + type: "number", + required: true + }) + .positional('contract_address', { + describe: 'contract to upgrade to', + type: "string", + required: true + }) + .option('guardian_secret', { + describe: 'Guardian\'s secret key', + type: "string", + default: "cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0" + }) + }, async (argv: any) => { + let data = [ + "0x", + "00000000000000000000000000000000000000000000004e4654427269646765", // NFT Bridge header + "02", + ethers.utils.defaultAbiCoder.encode(["uint16"], [argv.chain_id]).substring(2 + (64 - 4)), + ethers.utils.defaultAbiCoder.encode(["bytes32"], [argv.contract_address]).substring(2), + ].join('') + + const vm = signAndEncodeVM( + 1, + 1, + 1, + "0x0000000000000000000000000000000000000000000000000000000000000004", + Math.floor(Math.random() * 100000000), + data, + [ + argv.guardian_secret + ], + 0, + 0 + ); + + console.log(vm) + }) .command('solana execute_governance_vaa [vaa]', 'execute a governance VAA on Solana', (yargs) => { return yargs .positional('vaa', { diff --git a/devnet/node.yaml b/devnet/node.yaml index 4215a74cc..d9dc8cc30 100644 --- a/devnet/node.yaml +++ b/devnet/node.yaml @@ -75,6 +75,8 @@ spec: - ws://eth-devnet:8545 - --avalancheRPC - ws://eth-devnet:8545 + - --auroraRPC + - ws://eth-devnet:8545 - --fantomRPC - ws://eth-devnet:8545 - --oasisRPC diff --git a/ethereum/.env.aurora.testnet b/ethereum/.env.aurora.testnet new file mode 100644 index 000000000..478080210 --- /dev/null +++ b/ethereum/.env.aurora.testnet @@ -0,0 +1,14 @@ +# Aurora testnet env +# Rename to .env to use with truffle migrations + +# Wormhole Core Migrations +INIT_SIGNERS=["0x13947Bd48b18E53fdAeEe77F3473391aC727C638"] +INIT_CHAIN_ID=0x9 +INIT_GOV_CHAIN_ID=0x1 +INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004 + +# Bridge Migrations +BRIDGE_INIT_CHAIN_ID=0x9 +BRIDGE_INIT_GOV_CHAIN_ID=0x1 +BRIDGE_INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004 +BRIDGE_INIT_WETH=0x9D29f395524B3C817ed86e2987A14c1897aFF849 diff --git a/ethereum/truffle-config.js b/ethereum/truffle-config.js index 70a08077d..4e920b576 100644 --- a/ethereum/truffle-config.js +++ b/ethereum/truffle-config.js @@ -129,8 +129,8 @@ module.exports = { ) }, network_id: 0x4e454153, - gas: 70000000, - gasPrice: 8000000000, + gas: 10000000, + from: "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0", // public key }, fantom: { provider: () => { diff --git a/node/cmd/guardiand/adminnodes.go b/node/cmd/guardiand/adminnodes.go index 3bf47ead5..626d310c5 100644 --- a/node/cmd/guardiand/adminnodes.go +++ b/node/cmd/guardiand/adminnodes.go @@ -107,6 +107,7 @@ func runListNodes(cmd *cobra.Command, args []string) { if isTestnet { networks = append(networks, network{"Ropsten", vaa.ChainIDEthereumRopsten}) + networks = append(networks, network{"Aurora", vaa.ChainIDAurora}) networks = append(networks, network{"Karura", vaa.ChainIDKarura}) networks = append(networks, network{"Acala", vaa.ChainIDAcala}) } diff --git a/node/cmd/guardiand/node.go b/node/cmd/guardiand/node.go index 0e39a4d08..0312754e6 100644 --- a/node/cmd/guardiand/node.go +++ b/node/cmd/guardiand/node.go @@ -75,6 +75,9 @@ var ( ethRopstenRPC *string ethRopstenContract *string + auroraRPC *string + auroraContract *string + fantomRPC *string fantomContract *string @@ -164,6 +167,9 @@ func init() { oasisRPC = NodeCmd.Flags().String("oasisRPC", "", "Oasis RPC URL") oasisContract = NodeCmd.Flags().String("oasisContract", "", "Oasis contract address") + auroraRPC = NodeCmd.Flags().String("auroraRPC", "", "Aurora Websocket RPC URL") + auroraContract = NodeCmd.Flags().String("auroraContract", "", "Aurora contract address") + fantomRPC = NodeCmd.Flags().String("fantomRPC", "", "Fantom Websocket RPC URL") fantomContract = NodeCmd.Flags().String("fantomContract", "", "Fantom contract address") @@ -301,6 +307,7 @@ func runNode(cmd *cobra.Command, args []string) { if *testnetMode { readiness.RegisterComponent(common.ReadinessEthRopstenSyncing) + readiness.RegisterComponent(common.ReadinessAuroraSyncing) readiness.RegisterComponent(common.ReadinessKaruraSyncing) readiness.RegisterComponent(common.ReadinessAcalaSyncing) } @@ -346,6 +353,7 @@ func runNode(cmd *cobra.Command, args []string) { *polygonContract = devnet.GanacheWormholeContractAddress.Hex() *avalancheContract = devnet.GanacheWormholeContractAddress.Hex() *oasisContract = devnet.GanacheWormholeContractAddress.Hex() + *auroraContract = devnet.GanacheWormholeContractAddress.Hex() *fantomContract = devnet.GanacheWormholeContractAddress.Hex() *karuraContract = devnet.GanacheWormholeContractAddress.Hex() *acalaContract = devnet.GanacheWormholeContractAddress.Hex() @@ -402,6 +410,12 @@ func runNode(cmd *cobra.Command, args []string) { if *ethRopstenContract == "" { logger.Fatal("Please specify --ethRopstenContract") } + if *auroraRPC == "" { + logger.Fatal("Please specify --auroraRPC") + } + if *auroraContract == "" { + logger.Fatal("Please specify --auroraContract") + } if *karuraRPC == "" { logger.Fatal("Please specify --karuraRPC") } @@ -421,6 +435,12 @@ func runNode(cmd *cobra.Command, args []string) { if *ethRopstenContract != "" { logger.Fatal("Please do not specify --ethRopstenContract in non-testnet mode") } + if *auroraRPC != "" && !*unsafeDevMode { + logger.Fatal("Please do not specify --auroraRPC") + } + if *auroraContract != "" && !*unsafeDevMode { + logger.Fatal("Please do not specify --auroraContract") + } if *karuraRPC != "" && !*unsafeDevMode { logger.Fatal("Please do not specify --karuraRPC") } @@ -517,6 +537,7 @@ func runNode(cmd *cobra.Command, args []string) { ethRopstenContractAddr := eth_common.HexToAddress(*ethRopstenContract) avalancheContractAddr := eth_common.HexToAddress(*avalancheContract) oasisContractAddr := eth_common.HexToAddress(*oasisContract) + auroraContractAddr := eth_common.HexToAddress(*auroraContract) fantomContractAddr := eth_common.HexToAddress(*fantomContract) karuraContractAddr := eth_common.HexToAddress(*karuraContract) acalaContractAddr := eth_common.HexToAddress(*acalaContract) @@ -755,6 +776,10 @@ func runNode(cmd *cobra.Command, args []string) { ethereum.NewEthWatcher(*ethRopstenRPC, ethRopstenContractAddr, "ethropsten", common.ReadinessEthRopstenSyncing, vaa.ChainIDEthereumRopsten, lockC, nil, 1, chainObsvReqC[vaa.ChainIDEthereumRopsten]).Run); err != nil { return err } + if err := supervisor.Run(ctx, "aurorawatch", + ethereum.NewEthWatcher(*auroraRPC, auroraContractAddr, "aurora", common.ReadinessAuroraSyncing, vaa.ChainIDAurora, lockC, nil, 1, chainObsvReqC[vaa.ChainIDAurora]).Run); err != nil { + return err + } if err := supervisor.Run(ctx, "karurawatch", ethereum.NewEthWatcher(*karuraRPC, karuraContractAddr, "karura", common.ReadinessKaruraSyncing, vaa.ChainIDKarura, lockC, nil, 1, chainObsvReqC[vaa.ChainIDKarura]).Run); err != nil { return err diff --git a/node/pkg/common/readiness.go b/node/pkg/common/readiness.go index 290380b19..e33a88880 100644 --- a/node/pkg/common/readiness.go +++ b/node/pkg/common/readiness.go @@ -12,6 +12,7 @@ const ( ReadinessEthRopstenSyncing readiness.Component = "ethRopstenSyncing" ReadinessAvalancheSyncing readiness.Component = "avalancheSyncing" ReadinessOasisSyncing readiness.Component = "oasisSyncing" + ReadinessAuroraSyncing readiness.Component = "auroraSyncing" ReadinessFantomSyncing readiness.Component = "fantomSyncing" ReadinessKaruraSyncing readiness.Component = "karuraSyncing" ReadinessAcalaSyncing readiness.Component = "acalaSyncing" diff --git a/node/pkg/ethereum/watcher.go b/node/pkg/ethereum/watcher.go index 9e0b5a787..7ab1e6edf 100644 --- a/node/pkg/ethereum/watcher.go +++ b/node/pkg/ethereum/watcher.go @@ -369,6 +369,11 @@ func (e *Watcher) Run(ctx context.Context) error { p2p.DefaultRegistry.AddErrorCount(e.chainID, 1) return case ev := <-headSink: + if ev == nil { + logger.Error("new header event is nil", zap.String("eth_network", e.networkName)) + continue + } + start := time.Now() currentHash := ev.Hash() logger.Info("processing new header", diff --git a/node/pkg/vaa/structs.go b/node/pkg/vaa/structs.go index d7b95008b..dacd843eb 100644 --- a/node/pkg/vaa/structs.go +++ b/node/pkg/vaa/structs.go @@ -98,6 +98,8 @@ func (c ChainID) String() string { return "avalanche" case ChainIDOasis: return "oasis" + case ChainIDAurora: + return "aurora" case ChainIDFantom: return "fantom" case ChainIDAlgorand: @@ -131,6 +133,8 @@ func ChainIDFromString(s string) (ChainID, error) { return ChainIDAvalanche, nil case "oasis": return ChainIDOasis, nil + case "aurora": + return ChainIDAurora, nil case "fantom": return ChainIDFantom, nil case "algorand": @@ -164,6 +168,8 @@ const ( ChainIDOasis ChainID = 7 // ChainIDAlgorand is the ChainID of Algorand ChainIDAlgorand ChainID = 8 + // ChainIDAurora is the ChainID of Aurora + ChainIDAurora ChainID = 9 // ChainIDFantom is the ChainID of Fantom ChainIDFantom ChainID = 10 // ChainIDKarura is the ChainID of Karura diff --git a/proto/publicrpc/v1/publicrpc.proto b/proto/publicrpc/v1/publicrpc.proto index d09e0b33a..d2e94d1aa 100644 --- a/proto/publicrpc/v1/publicrpc.proto +++ b/proto/publicrpc/v1/publicrpc.proto @@ -17,6 +17,7 @@ enum ChainID { CHAIN_ID_AVALANCHE = 6; CHAIN_ID_OASIS = 7; CHAIN_ID_ALGORAND = 8; + CHAIN_ID_AURORA = 9; CHAIN_ID_FANTOM = 10; CHAIN_ID_KARURA = 11; CHAIN_ID_ACALA = 12;