Testnet support for Aurora (#947)

* Testnet support

* Upgrade contract for 1conf

* Formatting changes

Change-Id: Id06481d77d770a04eb200aadb82574e23cddcd36
This commit is contained in:
bruce-riley 2022-03-15 09:41:10 -05:00 committed by GitHub
parent 21e2a710a7
commit b718225e45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 99 additions and 2 deletions

View File

@ -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', {

View File

@ -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

View File

@ -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

View File

@ -129,8 +129,8 @@ module.exports = {
)
},
network_id: 0x4e454153,
gas: 70000000,
gasPrice: 8000000000,
gas: 10000000,
from: "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0", // public key
},
fantom: {
provider: () => {

View File

@ -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})
}

View File

@ -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

View File

@ -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"

View File

@ -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",

View File

@ -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

View File

@ -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;