Skip to content

Commit

Permalink
Aylin configs (#129)
Browse files Browse the repository at this point in the history
* subnet configs

* modify precompile/genesis contract addresses

* remove fields only required for validators from api node configs

* choose addresses within allowed range

* choose new addresses 1 final time :D

* revert unintented change
  • Loading branch information
atvanguard authored Oct 3, 2023
1 parent 0a8f538 commit 06d0c5a
Show file tree
Hide file tree
Showing 21 changed files with 91 additions and 92 deletions.
10 changes: 5 additions & 5 deletions constants/hubble.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package constants

const OrderBookContractAddress = "0x0300000000000000000000000000000000000000"
const MarginAccountContractAddress = "0x0300000000000000000000000000000000000001"
const ClearingHouseContractAddress = "0x0300000000000000000000000000000000000002"
const LimitOrderBookContractAddress = "0x0300000000000000000000000000000000000005"
const IOCOrderBookContractAddress = "0x0300000000000000000000000000000000000006"
const OrderBookContractAddress = "0x03000000000000000000000000000000000000b0"
const MarginAccountContractAddress = "0x03000000000000000000000000000000000000b1"
const ClearingHouseContractAddress = "0x03000000000000000000000000000000000000b2"
const LimitOrderBookContractAddress = "0x03000000000000000000000000000000000000b3"
const IOCOrderBookContractAddress = "0x03000000000000000000000000000000000000b4"
2 changes: 1 addition & 1 deletion contracts/test/hubble-v2/OrderBook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BigNumber } from "ethers"

// make sure this is always an admin for minter precompile
const adminAddress: string = "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC"
const GENESIS_ORDERBOOK_ADDRESS = '0x0300000000000000000000000000000000000000'
const GENESIS_ORDERBOOK_ADDRESS = '0x03000000000000000000000000000000000000b0'

describe.only('Order Book', function () {
let orderBook, alice, bob, longOrder, shortOrder, domain, orderType, signature
Expand Down
13 changes: 5 additions & 8 deletions genesis.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"state-sync-enabled": true,
"snowman-api-enabled": true,
"local-txs-enabled": true,
"priority-regossip-frequency": "1s",
"tx-regossip-max-size": 32,
"priority-regossip-max-txs": 32,
"priority-regossip-txs-per-address": 20,
"priority-regossip-addresses": ["0xeAA6AE79bD3d042644D91edD786E4ed3d783Ca2d"],
"priority-regossip-addresses": ["0x06CCAD927e6B1d36E219Cb582Af3185D0705f78F"],
"validator-private-key-file": "/home/ubuntu/validator.pk",
"feeRecipient": "0x393bd9ac9dbBe75e84db739Bb15d22cA86D26696",
"is-validator": true,
"trading-api-enabled": false,
"load-from-snapshot-enabled": true
"feeRecipient": "<insert address corresponding to private key above>",
"is-validator": true
}
12 changes: 12 additions & 0 deletions network-configs/aylin/chain_api_node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"snowman-api-enabled": true,
"local-txs-enabled": true,
"priority-regossip-frequency": "1s",
"tx-regossip-max-size": 32,
"priority-regossip-max-txs": 32,
"priority-regossip-txs-per-address": 20,
"priority-regossip-addresses": ["0x06CCAD927e6B1d36E219Cb582Af3185D0705f78F"],
"coreth-admin-api-enabled": true,
"eth-apis": ["public-eth","public-eth-filter","net","web3","internal-public-eth","internal-public-blockchain","internal-public-transaction-pool","internal-public-debug","internal-private-debug","internal-public-tx-pool","internal-public-account","debug-tracer"],
"trading-api-enabled": true
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
{
"state-sync-enabled": false,
"pruning-enabled": false,
"snowman-api-enabled": true,
"local-txs-enabled": true,
"priority-regossip-frequency": "1s",
"tx-regossip-max-size": 32,
"priority-regossip-max-txs": 32,
"priority-regossip-txs-per-address": 20,
"priority-regossip-addresses": ["0xeAA6AE79bD3d042644D91edD786E4ed3d783Ca2d","0x93dAc05dE54C9d5ee5C59F77518F931168FDEC9b","0xCe743BFA1feaed060adBadfc8974be544b251Fe8"],
"priority-regossip-addresses": ["0x06CCAD927e6B1d36E219Cb582Af3185D0705f78F"],
"coreth-admin-api-enabled": true,
"pruning-enabled": false,
"eth-apis": ["public-eth","public-eth-filter","net","web3","internal-public-eth","internal-public-blockchain","internal-public-transaction-pool","internal-public-debug","internal-private-debug","internal-public-tx-pool","internal-public-account","debug-tracer"],
"validator-private-key-file": "/home/ubuntu/validator.pk",
"feeRecipient": "0x93ec352b9eDe4e4515b24945E37186c462a2D583",
"is-validator": false,
"trading-api-enabled": true,
"load-from-snapshot-enabled": true
"trading-api-enabled": true
}

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions network-configs/aylin/subnet-id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"proposerMinBlockDelay": 0
}
20 changes: 0 additions & 20 deletions networks/hubblenext/upgrade.json

This file was deleted.

10 changes: 5 additions & 5 deletions plugin/evm/orderbook/tx_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
"github.com/ethereum/go-ethereum/log"
)

var OrderBookContractAddress = common.HexToAddress("0x0300000000000000000000000000000000000000")
var MarginAccountContractAddress = common.HexToAddress("0x0300000000000000000000000000000000000001")
var ClearingHouseContractAddress = common.HexToAddress("0x0300000000000000000000000000000000000002")
var LimitOrderBookContractAddress = common.HexToAddress("0x0300000000000000000000000000000000000005")
var IOCOrderBookContractAddress = common.HexToAddress("0x0300000000000000000000000000000000000006")
var OrderBookContractAddress = common.HexToAddress("0x03000000000000000000000000000000000000b0")
var MarginAccountContractAddress = common.HexToAddress("0x03000000000000000000000000000000000000b1")
var ClearingHouseContractAddress = common.HexToAddress("0x03000000000000000000000000000000000000b2")
var LimitOrderBookContractAddress = common.HexToAddress("0x03000000000000000000000000000000000000b3")
var IOCOrderBookContractAddress = common.HexToAddress("0x03000000000000000000000000000000000000b4")

type LimitOrderTxProcessor interface {
GetOrderBookTxsCount() uint64
Expand Down
4 changes: 2 additions & 2 deletions plugin/evm/orderbook_test.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion precompile/contracts/bibliophile/clearing_house.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

const (
CLEARING_HOUSE_GENESIS_ADDRESS = "0x0300000000000000000000000000000000000002"
CLEARING_HOUSE_GENESIS_ADDRESS = "0x03000000000000000000000000000000000000b2"
MAINTENANCE_MARGIN_SLOT int64 = 1
MIN_ALLOWABLE_MARGIN_SLOT int64 = 2
TAKER_FEE_SLOT int64 = 3
Expand Down
2 changes: 1 addition & 1 deletion precompile/contracts/bibliophile/ioc_order_book.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

const (
IOC_ORDERBOOK_ADDRESS = "0x0300000000000000000000000000000000000006"
IOC_ORDERBOOK_ADDRESS = "0x03000000000000000000000000000000000000b4"
IOC_ORDER_INFO_SLOT int64 = 1
IOC_EXPIRATION_CAP_SLOT int64 = 2
)
Expand Down
2 changes: 1 addition & 1 deletion precompile/contracts/bibliophile/limit_order_book.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

const (
LIMIT_ORDERBOOK_GENESIS_ADDRESS = "0x0300000000000000000000000000000000000005"
LIMIT_ORDERBOOK_GENESIS_ADDRESS = "0x03000000000000000000000000000000000000b3"
ORDER_INFO_SLOT int64 = 1
REDUCE_ONLY_AMOUNT_SLOT int64 = 2
LONG_OPEN_ORDERS_SLOT int64 = 4
Expand Down
2 changes: 1 addition & 1 deletion precompile/contracts/bibliophile/margin_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

const (
MARGIN_ACCOUNT_GENESIS_ADDRESS = "0x0300000000000000000000000000000000000001"
MARGIN_ACCOUNT_GENESIS_ADDRESS = "0x03000000000000000000000000000000000000b1"
ORACLE_SLOT int64 = 4
SUPPORTED_COLLATERAL_SLOT int64 = 8
MARGIN_MAPPING_SLOT int64 = 10
Expand Down
2 changes: 1 addition & 1 deletion precompile/contracts/bibliophile/orderbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

const (
ORDERBOOK_GENESIS_ADDRESS = "0x0300000000000000000000000000000000000000"
ORDERBOOK_GENESIS_ADDRESS = "0x03000000000000000000000000000000000000b0"
IS_VALIDATOR_SLOT int64 = 1
IS_TRADING_AUTHORITY_SLOT int64 = 2
)
Expand Down
2 changes: 1 addition & 1 deletion precompile/contracts/juror/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ConfigKey = "jurorConfig"
// ContractAddress is the defined address of the precompile contract.
// This should be unique across all precompile contracts.
// See precompile/registry/registry.go for registered precompile contracts and more information.
var ContractAddress = common.HexToAddress("0x0300000000000000000000000000000000000003") // SET A SUITABLE HEX ADDRESS HERE
var ContractAddress = common.HexToAddress("0x03000000000000000000000000000000000000a0") // SET A SUITABLE HEX ADDRESS HERE

// Module is the precompile module. It is used to register the precompile contract.
var Module = modules.Module{
Expand Down
2 changes: 1 addition & 1 deletion precompile/contracts/ticks/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ConfigKey = "ticksConfig"
// ContractAddress is the defined address of the precompile contract.
// This should be unique across all precompile contracts.
// See precompile/registry/registry.go for registered precompile contracts and more information.
var ContractAddress = common.HexToAddress("0x0300000000000000000000000000000000000004") // SET A SUITABLE HEX ADDRESS HERE
var ContractAddress = common.HexToAddress("0x03000000000000000000000000000000000000a1") // SET A SUITABLE HEX ADDRESS HERE

// Module is the precompile module. It is used to register the precompile contract.
var Module = modules.Module{
Expand Down
20 changes: 12 additions & 8 deletions precompile/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
// These start at the address: 0x0100000000000000000000000000000000000000 and will increment by 1.
// Optional precompiles implemented in subnet-evm start at 0x0200000000000000000000000000000000000000 and will increment by 1
// from here to reduce the risk of conflicts.
// For forks of subnet-evm, users should start at 0x0300000000000000000000000000000000000000 to ensure
// For forks of subnet-evm, users should start at 0x03000000000000000000000000000000000000b0 to ensure
// that their own modifications do not conflict with stateful precompiles that may be added to subnet-evm
// in the future.
// ContractDeployerAllowListAddress = common.HexToAddress("0x0200000000000000000000000000000000000000")
Expand All @@ -42,12 +42,16 @@ import (
// FeeManagerAddress = common.HexToAddress("0x0200000000000000000000000000000000000003")
// RewardManagerAddress = common.HexToAddress("0x0200000000000000000000000000000000000004")
// WarpAddress = common.HexToAddress("0x0200000000000000000000000000000000000005")

// ADD YOUR PRECOMPILE HERE
// OrderBook = common.HexToAddress("0x0300000000000000000000000000000000000000")
// MarginAccount = common.HexToAddress("0x0300000000000000000000000000000000000001")
// ClearingHouse = common.HexToAddress("0x0300000000000000000000000000000000000002")
// juror = common.HexToAddress("0x0300000000000000000000000000000000000003")
// ticks = common.HexToAddress("0x0300000000000000000000000000000000000004")
// limitOrderBook = common.HexToAddress("0x0300000000000000000000000000000000000005")
// iocOrderBook = common.HexToAddress("0x0300000000000000000000000000000000000006")
// juror = common.HexToAddress("0x03000000000000000000000000000000000000a0")
// ticks = common.HexToAddress("0x03000000000000000000000000000000000000a1")

// GenesisAddress
// OrderBook = common.HexToAddress("0x03000000000000000000000000000000000000b0")
// MarginAccount = common.HexToAddress("0x03000000000000000000000000000000000000b1")
// ClearingHouse = common.HexToAddress("0x03000000000000000000000000000000000000b2")
// limitOrderBook = common.HexToAddress("0x03000000000000000000000000000000000000b3")
// iocOrderBook = common.HexToAddress("0x03000000000000000000000000000000000000b4")

// {YourPrecompile}Address = common.HexToAddress("0x03000000000000000000000000000000000000??")
6 changes: 3 additions & 3 deletions tests/orderbook/tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const axios = require('axios');
const { expect } = require('chai');
const { randomInt } = require('crypto');

const OrderBookContractAddress = "0x0300000000000000000000000000000000000000"
const MarginAccountContractAddress = "0x0300000000000000000000000000000000000001"
const OrderBookContractAddress = "0x03000000000000000000000000000000000000b0"
const MarginAccountContractAddress = "0x03000000000000000000000000000000000000b1"
const MarginAccountHelperContractAddress = "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82"
const ClearingHouseContractAddress = "0x0300000000000000000000000000000000000002"
const ClearingHouseContractAddress = "0x03000000000000000000000000000000000000b2"

let provider, domain, orderType, orderBook, marginAccount, marginAccountHelper, clearingHouse
let alice, bob, charlie, aliceAddress, bobAddress, charlieAddress
Expand Down
14 changes: 7 additions & 7 deletions tests/orderbook/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ alice = new ethers.Wallet('0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f
bob = new ethers.Wallet('0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a', provider); // 0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc
charlie = new ethers.Wallet('15614556be13730e9e8d6eacc1603143e7b96987429df8726384c2ec4502ef6e', provider); // 0x55ee05df718f1a5c1441e76190eb1a19ee2c9430

const OrderBookContractAddress = "0x0300000000000000000000000000000000000000"
const MarginAccountContractAddress = "0x0300000000000000000000000000000000000001"
const ClearingHouseContractAddress = "0x0300000000000000000000000000000000000002"
const JurorPrecompileAddress = "0x0300000000000000000000000000000000000003"
const TicksPrecompileAddress = "0x0300000000000000000000000000000000000004"
const LimitOrderBookContractAddress = "0x0300000000000000000000000000000000000005"
const IOCContractAddress = "0x0300000000000000000000000000000000000006"
const OrderBookContractAddress = "0x03000000000000000000000000000000000000b0"
const MarginAccountContractAddress = "0x03000000000000000000000000000000000000b1"
const ClearingHouseContractAddress = "0x03000000000000000000000000000000000000b2"
const JurorPrecompileAddress = "0x03000000000000000000000000000000000000a0"
const TicksPrecompileAddress = "0x03000000000000000000000000000000000000a1"
const LimitOrderBookContractAddress = "0x03000000000000000000000000000000000000b3"
const IOCContractAddress = "0x03000000000000000000000000000000000000b4"

orderBook = new ethers.Contract(OrderBookContractAddress, require('./abi/OrderBook.json'), provider);
limitOrderBook = new ethers.Contract(LimitOrderBookContractAddress, require('./abi/LimitOrderBook.json'), provider);
Expand Down

0 comments on commit 06d0c5a

Please sign in to comment.