Skip to content

Commit

Permalink
fix some variables
Browse files Browse the repository at this point in the history
  • Loading branch information
utolp committed Aug 14, 2018
1 parent b14de68 commit fb4c7fe
Show file tree
Hide file tree
Showing 21 changed files with 60 additions and 127 deletions.
67 changes: 0 additions & 67 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -1,67 +0,0 @@
**0.6.0**

* The DEX's Order Match transaction has been changed. This is the main reason for restarting Testnet. Now, a second asset of transaction's pair is used to set an amount of the transaction.
* LPOS was implemented. New Leasing and Leasing Cancel transactions were added.
* New, HOCON based, configuration file. Old configuration file (JSON based) is supported in this release for backward compatibility. Automatic configuration file conversion added to DEB packages.

**0.3.2**

* By default walletDir and dataDir located in $HOME/waves

**0.3.1**

* HTTP API /scorex removed. Use /node instead.

**0.2.2**

* Switch network by "testnet" in settings. Default value is true."
* /scorex/* HTTP API deprecated. Use /node/* instead.
* All logs goes to stdout and stderr. Use "loggingLevel" in config.

**0.2.1**

* peers.dat format changed. Delete old version.
* Different HTTP status codes in replies in HTTP API were implemented
* Waves' Scorex v1.3.2

**0.2.0**

* Peers blacklist ttl configuration via "p2p"/"blacklistResidenceTimeMilliseconds"
* Upgrade to Waves' Scorex v1.3.1

**0.2.0-RC7**

* New API /waves/payment returns senderPublicKey
* New API /waves/create-signed-payment
* /waves/external-payment deprecated.
Use new /waves/broadcast-signed-payment.
* New API /waves/payment/signature
* minimumTxFee verification for API

**0.2.0-RC5**

* /waves/external-payment returns error for incorrect recipient

**0.2.0-RC4**

* Fixed issue with incorrect Handshake
* Balance with confirmations is the minimum balance
* /waves/external-payment returns error if account balance invalid
* New API method /consensus/generatingbalance/{address}

**0.2.0-RC3**

* Incompatible with 0.1.3
* Upgrade to Scorex 1.2.8
* New Address format
* New hash chain for Address - Blake2b256, Keccak32
* New Testnet Genesis

**0.1.3**

* Upgrade to Scorex 1.2.6.
* New http api method /external-payment for lite client

**0.1.2**

* Upgrade to Scorex 1.2.4. Clean /scorex/waves/data/ before run.
6 changes: 3 additions & 3 deletions src/it/container/start-vee.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VEE_NET_IP=`ifconfig eth1 | awk '/inet addr/ {gsub("addr:", "", $2); print $2}'`

echo Default: $DEFAULT_NET_IP
echo Vee: $VEE_NET_IP
echo Options: $WAVES_OPTS
echo Options: $VEE_OPTS

#java -Dvee.network.declared-address=$VEE_NET_IP:$WAVES_PORT $WAVES_OPTS -jar /opt/vee/vee.jar /opt/vee/template.conf
java -Dvee.network.declared-address=$DEFAULT_NET_IP:9923 $WAVES_OPTS -jar /opt/vee/vee.jar /opt/vee/template.conf
#java -Dvee.network.declared-address=$VEE_NET_IP:$VEE_PORT $VEE_OPTS -jar /opt/vee/vee.jar /opt/vee/template.conf
java -Dvee.network.declared-address=$DEFAULT_NET_IP:9923 $VEE_OPTS -jar /opt/vee/vee.jar /opt/vee/template.conf
10 changes: 5 additions & 5 deletions src/it/scala/com/wavesplatform/it/Docker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Docker(suiteConfig: Config = ConfigFactory.empty) extends AutoCloseable wi

private val networkName = "vee-" + this.##.toLong.toHexString

private val wavesNetwork = client.createNetwork(NetworkConfig.builder().driver("bridge").name(networkName).build())
private val veeNetwork = client.createNetwork(NetworkConfig.builder().driver("bridge").name(networkName).build())

def startNode(nodeConfig: Config): Node = {
val configOverrides = s"$knownPeers ${renderProperties(asProperties(nodeConfig.withFallback(suiteConfig)))}"
Expand Down Expand Up @@ -79,7 +79,7 @@ class Docker(suiteConfig: Config = ConfigFactory.empty) extends AutoCloseable wi
.image("vee.tech/vee-core :latest")
.exposedPorts(restApiPort, networkPort, matcherApiPort)
.hostConfig(hostConfig)
.env(s"WAVES_OPTS=$configOverrides", s"WAVES_PORT=$networkPort")
.env(s"VEE_OPTS=$configOverrides", s"VEE_PORT=$networkPort")
.build()

val containerId = client.createContainer(containerConfig, actualConfig.getString("vee.network.node-name") + "-" +
Expand Down Expand Up @@ -116,16 +116,16 @@ class Docker(suiteConfig: Config = ConfigFactory.empty) extends AutoCloseable wi
log.info("Stopping containers")
nodes.values.foreach(n => n.close())
nodes.keys.foreach(id => client.removeContainer(id, RemoveContainerParam.forceKill()))
client.removeNetwork(wavesNetwork.id())
client.removeNetwork(veeNetwork.id())
client.close()
http.close()
}
}

def disconnectFromNetwork(containerId: String): Unit = client.disconnectFromNetwork(containerId, wavesNetwork.id())
def disconnectFromNetwork(containerId: String): Unit = client.disconnectFromNetwork(containerId, veeNetwork.id())
def disconnectFromNetwork(node: Node): Unit = disconnectFromNetwork(node.nodeInfo.containerId)

def connectToNetwork(containerId: String): Unit = client.connectToNetwork(containerId, wavesNetwork.id())
def connectToNetwork(containerId: String): Unit = client.connectToNetwork(containerId, veeNetwork.id())
def connectToNetwork(node: Node): Unit = connectToNetwork(node.nodeInfo.containerId)
}

Expand Down
2 changes: 1 addition & 1 deletion src/it/scala/com/wavesplatform/it/Node.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ class Node(config: Config, val nodeInfo: NodeInfo, override val client: AsyncHtt
override val networkPort: Int = nodeInfo.hostNetworkPort
override val blockDelay: FiniteDuration = settings.blockchainSettings.genesisSettings.averageBlockDelay

def fee(txValue: TransactionType.Value, asset: String = "WAVES"): Long =
def fee(txValue: TransactionType.Value, asset: String = "VEE"): Long =
settings.feesSettings.fees(txValue.id).find(_.asset == asset).get.fee
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BurnTransactionSpecification(override val allNodes: Seq[Node], override va
extends IntegrationSuiteWithThreeAddresses {

private val defaultQuantity = 100000
test("burning assets changes issuer's asset balance; issuer's waves balance is decreased by fee") {
test("burning assets changes issuer's asset balance; issuer's vee balance is decreased by fee") {
val f = for {
_ <- assertBalances(firstAddress, 100.vee, 100.vee)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import scala.concurrent.duration._

class IssueTransactionSpecification(override val allNodes: Seq[Node], override val notMiner: Node)
extends IntegrationSuiteWithThreeAddresses {
test("asset issue changes issuer's asset balance; issuer's waves balance is decreased by fee") {
test("asset issue changes issuer's asset balance; issuer's vee balance is decreased by fee") {
val f = for {
_ <- assertBalances(firstAddress, 100.vee, 100.vee)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import scala.concurrent.duration._

class PaymentTransactionSpecification(override val allNodes: Seq[Node], override val notMiner: Node)
extends IntegrationSuiteWithThreeAddresses {
test("waves payment changes waves balances and eff.b.") {
test("vee payment changes vee balances and eff.b.") {
val f = for {
_ <- assertBalances(firstAddress, 100.vee, 100.vee)
_ <- assertBalances(secondAddress, 100.vee, 100.vee)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ReissueTransactionSpecification(override val allNodes: Seq[Node], override

private val defaultQuantity = 100000

test("asset reissue changes issuer's asset balance; issuer's waves balance is decreased by fee") {
test("asset reissue changes issuer's asset balance; issuer's vee balance is decreased by fee") {
val f = for {
_ <- assertBalances(firstAddress, 100.vee, 100.vee)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TransferTransactionSpecification(override val allNodes: Seq[Node], overrid

private val defaultQuantity = 100000

test("asset transfer changes sender's and recipient's asset balance; issuer's.waves balance is decreased by fee") {
test("asset transfer changes sender's and recipient's asset balance; issuer's.vee balance is decreased by fee") {
val f = for {
_ <- assertBalances(firstAddress, 100.vee, 100.vee)
_ <- assertBalances(secondAddress, 100.vee, 100.vee)
Expand Down Expand Up @@ -48,7 +48,7 @@ class TransferTransactionSpecification(override val allNodes: Seq[Node], overrid
Await.result(f, 1.minute)
}

test("waves transfer changes waves balances and eff.b.") {
test("vee transfer changes vee balances and eff.b.") {
val f = for {
_ <- assertBalances(firstAddress, 80.vee, 80.vee)
_ <- assertBalances(secondAddress, 100.vee, 100.vee)
Expand All @@ -66,7 +66,7 @@ class TransferTransactionSpecification(override val allNodes: Seq[Node], overrid
Await.result(f, 1.minute)
}

test("invalid signed waves transfer should not be in UTX or blockchain") {
test("invalid signed vee transfer should not be in UTX or blockchain") {
def createSignedTransferRequest(tx: TransferTransaction): SignedTransferRequest = {
import tx._
SignedTransferRequest(
Expand Down Expand Up @@ -125,7 +125,7 @@ class TransferTransactionSpecification(override val allNodes: Seq[Node], overrid
}


test("can not make transfer without having enough of waves") {
test("can not make transfer without having enough of vee") {
val f = for {
fb <- traverse(allNodes)(_.height).map(_.min)

Expand Down Expand Up @@ -170,7 +170,7 @@ class TransferTransactionSpecification(override val allNodes: Seq[Node], overrid
Await.result(f, 1.minute)
}

test("can not make transfer without having enough of your own waves") {
test("can not make transfer without having enough of your own vee") {
val f = for {
fb <- traverse(allNodes)(_.height).map(_.min)

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Waves node settings
# Vee node settings
vee {
# Node base directory
directory = ${user.home}"/vee"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ object ExchangeTransactionDiff {
val buyer = t.buyOrder.senderPublicKey.toAddress
val seller = t.sellOrder.senderPublicKey.toAddress

def wavesPortfolio(amt: Long) = Portfolio(amt, LeaseInfo.empty, Map.empty)
def veePortfolio(amt: Long) = Portfolio(amt, LeaseInfo.empty, Map.empty)

val feeDiff = Monoid.combineAll(Seq(
Map(matcher -> wavesPortfolio(t.buyMatcherFee + t.sellMatcherFee - t.fee)),
Map(buyer -> wavesPortfolio(-t.buyMatcherFee)),
Map(seller -> wavesPortfolio(-t.sellMatcherFee))))
Map(matcher -> veePortfolio(t.buyMatcherFee + t.sellMatcherFee - t.fee)),
Map(buyer -> veePortfolio(-t.buyMatcherFee)),
Map(seller -> veePortfolio(-t.sellMatcherFee))))

val priceDiff = t.buyOrder.assetPair.priceAsset match {
case Some(assetId) => Monoid.combine(
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/wavesplatform/utils/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ package object utils extends ScorexLogging {
}
}

def forceStopApplication(): Unit = new Thread(() => { System.exit(1) }, "waves-platform-shutdown-thread").start()
def forceStopApplication(): Unit = new Thread(() => { System.exit(1) }, "vee-shutdown-thread").start()
}
2 changes: 1 addition & 1 deletion src/templates/etc-default-systemd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Waves node environment file
# Vee node environment file
#JAVA_OPTS=""
8 changes: 4 additions & 4 deletions src/test/scala/com/wavesplatform/TransactionGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ trait TransactionGen {
val maxOrderTimeGen: Gen[Long] = Gen.choose(10000L, Order.MaxLiveTime).map(_ + NTP.correctedTime())
val timestampGen: Gen[Long] = Gen.choose(1, Long.MaxValue - 100)

val wavesAssetGen: Gen[Option[ByteStr]] = Gen.const(None)
val assetIdGen: Gen[Option[ByteStr]] = Gen.frequency((1, wavesAssetGen), (10, Gen.option(bytes32gen.map(ByteStr(_)))))
val veeAssetGen: Gen[Option[ByteStr]] = Gen.const(None)
val assetIdGen: Gen[Option[ByteStr]] = Gen.frequency((1, veeAssetGen), (10, Gen.option(bytes32gen.map(ByteStr(_)))))

val assetPairGen = assetIdGen.flatMap {
case None => bytes32gen.map(b => AssetPair(None, Some(ByteStr(b))))
Expand Down Expand Up @@ -169,11 +169,11 @@ trait TransactionGen {
} yield TransferTransaction.create(assetId, sender, recipient, amount, timestamp, feeAssetId, feeAmount, attachment).right.get)
.label("transferTransaction")

val transferWithWavesFeeGen = for {
val transferWithVeeFeeGen = for {
(assetId, sender, recipient, amount, timestamp, _, feeAmount, attachment) <- transferParamGen
} yield TransferTransaction.create(assetId, sender, recipient, amount, timestamp, None, feeAmount, attachment).right.get

val selfTransferWithWavesFeeGen: Gen[TransferTransaction] = for {
val selfTransferWithVeeFeeGen: Gen[TransferTransaction] = for {
(assetId, sender, _, amount, timestamp, _, feeAmount, attachment) <- transferParamGen
} yield TransferTransaction.create(assetId, sender, sender, amount, timestamp, None, feeAmount, attachment).right.get

Expand Down
28 changes: 14 additions & 14 deletions src/test/scala/com/wavesplatform/matcher/MatcherTestData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ trait MatcherTestData {
val accountGen: Gen[PrivateKeyAccount] = bytes32gen.map(seed => PrivateKeyAccount(seed))
val positiveLongGen: Gen[Long] = Gen.choose(1, Long.MaxValue)

val wavesAssetGen: Gen[Option[Array[Byte]]] = Gen.const(None)
val assetIdGen: Gen[Option[Array[Byte]]] = Gen.frequency((1, wavesAssetGen), (10, bytes32gen.map(Some(_))))
val veeAssetGen: Gen[Option[Array[Byte]]] = Gen.const(None)
val assetIdGen: Gen[Option[Array[Byte]]] = Gen.frequency((1, veeAssetGen), (10, bytes32gen.map(Some(_))))

val assetPairGen = Gen.zip(assetIdGen, assetIdGen).
suchThat(p => p._1 != p._2).
Expand Down Expand Up @@ -60,15 +60,15 @@ trait MatcherTestData {
value.get
}

val maxWavesAmountGen: Gen[Long] = Gen.choose(1, 100000000L * 100000000L)
val maxVeeAmountGen: Gen[Long] = Gen.choose(1, 100000000L * 100000000L)

def buyGenerator(pair: AssetPair, price: Long, amount: Long, sender: Option[PrivateKeyAccount] = None,
matcherFee: Option[Long] = None): Gen[(Order, PrivateKeyAccount)] =
for {
sender: PrivateKeyAccount <- sender.map(Gen.const).getOrElse(accountGen)
timestamp: Long <- createdTimeGen
expiration: Long <- maxTimeGen
matcherFee: Long <- matcherFee.map(Gen.const).getOrElse(maxWavesAmountGen)
matcherFee: Long <- matcherFee.map(Gen.const).getOrElse(maxVeeAmountGen)
} yield (Order.buy(sender, MatcherAccount, pair, price, amount, timestamp, expiration, matcherFee), sender)

def sellGenerator(pair: AssetPair, price: Long, amount: Long, sender: Option[PrivateKeyAccount] = None,
Expand All @@ -77,7 +77,7 @@ trait MatcherTestData {
sender: PrivateKeyAccount <- sender.map(Gen.const).getOrElse(accountGen)
timestamp: Long <- createdTimeGen
expiration: Long <- maxTimeGen
matcherFee: Long <- matcherFee.map(Gen.const).getOrElse(maxWavesAmountGen)
matcherFee: Long <- matcherFee.map(Gen.const).getOrElse(maxVeeAmountGen)
} yield (Order.sell(sender, MatcherAccount, pair, price, amount, timestamp, expiration, matcherFee), sender)

def buy(pair: AssetPair, price: BigDecimal, amount: Long, sender: Option[PrivateKeyAccount] = None,
Expand All @@ -94,31 +94,31 @@ trait MatcherTestData {
sender: PrivateKeyAccount <- accountGen
pair <- assetPairGen
orderType <- orderTypeGenerator
price: Long <- maxWavesAmountGen
amount: Long <- maxWavesAmountGen
price: Long <- maxVeeAmountGen
amount: Long <- maxVeeAmountGen
timestamp: Long <- createdTimeGen
expiration: Long <- maxTimeGen
matcherFee: Long <- maxWavesAmountGen
matcherFee: Long <- maxVeeAmountGen
} yield (Order(sender, MatcherAccount, pair, orderType, price, amount, timestamp, expiration, matcherFee), sender)

val buyLimitOrderGenerator: Gen[BuyLimitOrder] = for {
sender: PrivateKeyAccount <- accountGen
pair <- assetPairGen
price: Long <- maxWavesAmountGen
amount: Long <- maxWavesAmountGen
price: Long <- maxVeeAmountGen
amount: Long <- maxVeeAmountGen
timestamp: Long <- createdTimeGen
expiration: Long <- maxTimeGen
matcherFee: Long <- maxWavesAmountGen
matcherFee: Long <- maxVeeAmountGen
} yield BuyLimitOrder(price, amount, Order.buy(sender, MatcherAccount, pair, price, amount, timestamp, expiration, matcherFee))

val sellLimitOrderGenerator: Gen[SellLimitOrder] = for {
sender: PrivateKeyAccount <- accountGen
pair <- assetPairGen
price: Long <- maxWavesAmountGen
amount: Long <- maxWavesAmountGen
price: Long <- maxVeeAmountGen
amount: Long <- maxVeeAmountGen
timestamp: Long <- createdTimeGen
expiration: Long <- maxTimeGen
matcherFee: Long <- maxWavesAmountGen
matcherFee: Long <- maxVeeAmountGen
} yield SellLimitOrder(price, amount, Order.sell(sender, MatcherAccount, pair, price, amount, timestamp, expiration, matcherFee))

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ class OrderBookActorSpecification extends TestKit(ActorSystem("MatcherTest"))

var eventsProbe = TestProbe()

val pair = AssetPair(Some(ByteStr("BTC".getBytes)), Some(ByteStr("WAVES".getBytes)))
val pair = AssetPair(Some(ByteStr("BTC".getBytes)), Some(ByteStr("VEE".getBytes)))
val db = new MVStore.Builder().compress().open()
val storedState: StateReader = stub[StateReader]
val hugeAmount = Long.MaxValue / 2
(storedState.accountPortfolio _).when(*).returns(Portfolio(hugeAmount, LeaseInfo.empty, Map(
ByteStr("BTC".getBytes) -> hugeAmount,
ByteStr("WAVES".getBytes) -> hugeAmount
ByteStr("VEE".getBytes) -> hugeAmount
)))
val issueTransaction: IssueTransaction = IssueTransaction.create(
PrivateKeyAccount("123".getBytes),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class OrderValidatorSpecification extends WordSpec
}

val wbtc = ByteStr("WBTC".getBytes)
val pairWavesBtc = AssetPair(None, Some(wbtc))
val pairVeeBtc = AssetPair(None, Some(wbtc))

"OrderValidator" should {
"allows buy VEE for BTC without balance for order fee" in {
Expand All @@ -77,7 +77,7 @@ class OrderValidatorSpecification extends WordSpec
private def validateNewOrderTest(expectedPortfolio: Portfolio): Either[ValidationError.GenericError, Order] = {
(ov.utxPool.portfolio _).when(*).returns(expectedPortfolio)
val o = buy(
pair = pairWavesBtc,
pair = pairVeeBtc,
price = 0.0022,
amount = 100 * Constants.UnitsInVee,
matcherFee = Some((0.003 * Constants.UnitsInVee).toLong)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class EventJsonSpecification extends PropSpec
with Matchers
with MatcherTestData {

val pair = AssetPair(Some(ByteStr("BTC".getBytes)), Some(ByteStr("WAVES".getBytes)))
val pair = AssetPair(Some(ByteStr("BTC".getBytes)), Some(ByteStr("VEE".getBytes)))

val buyLevelGen: Gen[Vector[BuyLimitOrder]] =
Gen.containerOf[Vector, BuyLimitOrder](buyLimitOrderGenerator)
Expand Down
Loading

0 comments on commit fb4c7fe

Please sign in to comment.