Skip to content

Commit

Permalink
Merge pull request #18 from /issues/17
Browse files Browse the repository at this point in the history
Issues/17
  • Loading branch information
KarlChristomer authored Dec 8, 2022
2 parents db32118 + 12f2c38 commit 982c5ca
Show file tree
Hide file tree
Showing 52 changed files with 12,334 additions and 223 deletions.
3 changes: 3 additions & 0 deletions integration-testing/scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# gvite integration test
1. refer to [github action of gvite integration testing generator]("https://github.com/vitelabs/go-vite-nightly/blob/master/.github/workflows/govite-integration-testing-generator.yml"). The main purpose is to generate the ledger blocks based on v2.11.0 and upload to the Release.
2. refer to [github action of integration-testing]("https://github.com/vitelabs/go-vite-nightly/blob/master/.github/workflows/govite-integration-testing.yml"). The main purpose is to build a docker container based on the laster gvite release and using `gvite load` from the ledger of v2.11.0 to test the laster gvite.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions testing_v2.11/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "testing_v2.11",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test_v2.11.3": "vuilder test v2.11.3/*.spec.ts --config v2.11.3/vuilder.node.config.json"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/mocha": "^10.0.0",
"@vite/vuilder": "^0.1.0-alpha.21",
"install": "^0.13.0",
"typescript": "^4.7.2"
},
"dependencies": {
"@types/chai": "^4.3.1",
"@types/node": "^17.0.36",
"chai": "^4.3.6",
"mocha": "^10.0.0",
"ts-node": "^10.8.0"
}
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ let deployer: vuilder.UserAccount;
describe("test Cafe", () => {
before(async function () {
provider = vuilder.newProvider(config.networks.local.http);
console.log(await provider.request("ledger_getSnapshotChainHeight"));
deployer = vuilder.newAccount(config.networks.local.mnemonic, 0, provider);
console.log('current height', await provider.request("ledger_getSnapshotChainHeight"));
console.log('deployer', deployer.address);
});

Expand All @@ -29,7 +29,7 @@ describe("test Cafe", () => {

// call methods
let resArr: Array<any> = []
const num = 1;
const num = 5;
for (let i = 0; i < num; i++) {
const res = cafe.call(
"buyCoffee",
Expand All @@ -40,7 +40,6 @@ describe("test Cafe", () => {
await sleep(100)
}


// verify height of sendBlocks and receiveBlocks
let sendBlocks: Array<any> = []
let receiveHeights: Array<number> = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ let deployer: vuilder.UserAccount;
describe("test onroad", () => {
before(async function () {
provider = vuilder.newProvider(config.networks.local.http);
console.log(await provider.request("ledger_getSnapshotChainHeight"));
deployer = vuilder.newAccount(config.networks.local.mnemonic, 0, provider);
console.log('current height', await provider.request("ledger_getSnapshotChainHeight"));
console.log('deployer', deployer.address);
});

Expand Down Expand Up @@ -71,7 +71,7 @@ describe("test onroad", () => {
expect(isOrdered(receiveHeights, true)).to.be.true;
console.log("the receiveBlock`s height", receiveHeights);

await Promise.all(sendBlocks).then(sendBlocks => {
await Promise.all(sendBlocks).then(sendBlocks => {
// console.log("the sendBlock:", sendBlocks);
sendBlocks.forEach(sendBlock => {
sendHeights.push(Number(sendBlock.height));
Expand Down
3 changes: 3 additions & 0 deletions testing_v2.11/v2.11.3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# automated test for gvite v2.11.3

This directory is mainly about test cases for onroad logic.
File renamed without changes.
File renamed without changes.
63 changes: 63 additions & 0 deletions testing_v2.12/abi/fund.abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[
{"type":"function","name":"DexFundUserDeposit", "inputs":[]},
{"type":"function","name":"DexFundUserWithdraw", "inputs":[{"name":"token","type":"tokenId"},{"name":"amount","type":"uint256"}]},
{"type":"function","name":"DexFundNewMarket", "inputs":[{"name":"tradeToken","type":"tokenId"}, {"name":"quoteToken","type":"tokenId"}]},
{"type":"function","name":"DexFundNewOrder", "inputs":[{"name":"tradeToken","type":"tokenId"}, {"name":"quoteToken","type":"tokenId"}, {"name":"side", "type":"bool"}, {"name":"orderType", "type":"uint8"}, {"name":"price", "type":"string"}, {"name":"quantity", "type":"uint256"}]},
{"type":"function","name":"DexFundSettleOrders", "inputs":[{"name":"data","type":"bytes"}]},
{"type":"function","name":"DexFundPeriodJob", "inputs":[{"name":"periodId","type":"uint64"},{"name":"bizType","type":"uint8"}]},
{"type":"function","name":"DexFundPledgeForVx", "inputs":[{"name":"actionType","type":"uint8"}, {"name":"amount","type":"uint256"}]},
{"type":"function","name":"DexFundPledgeForVip", "inputs":[{"name":"actionType","type":"uint8"}]},
{"type":"function","name":"AgentPledgeCallback", "inputs":[{"name":"stakeAddress","type":"address"},{"name":"beneficiary","type":"address"},{"name":"amount","type":"uint256"},{"name":"bid","type":"uint8"},{"name":"success","type":"bool"}]},
{"type":"function","name":"AgentCancelPledgeCallback", "inputs":[{"name":"stakeAddress","type":"address"},{"name":"beneficiary","type":"address"},{"name":"amount","type":"uint256"},{"name":"bid","type":"uint8"},{"name":"success","type":"bool"}]},
{"type":"function","name":"GetTokenInfoCallback", "inputs":[{"name":"tokenId","type":"tokenId"},{"name":"bid","type":"uint8"},{"name":"exist","type":"bool"},{"name":"decimals","type":"uint8"},{"name":"tokenSymbol","type":"string"},{"name":"index","type":"uint16"},{"name":"owner","type":"address"}]},
{"type":"function","name":"DexFundOwnerConfig", "inputs":[{"name":"operationCode","type":"uint8"},{"name":"owner","type":"address"},{"name":"timeOracle","type":"address"},{"name":"periodJobTrigger","type":"address"},{"name":"stopDex","type":"bool"},{"name":"makerMiningAdmin","type":"address"},{"name":"maintainer","type":"address"}]},
{"type":"function","name":"DexFundOwnerConfigTrade", "inputs":[{"name":"operationCode","type":"uint8"},{"name":"tradeToken","type":"tokenId"},{"name":"quoteToken","type":"tokenId"},{"name":"allowMining","type":"bool"},{"name":"newQuoteToken","type":"tokenId"},{"name":"quoteTokenType","type":"uint8"},{"name":"tokenTypeForTradeThreshold","type":"uint8"},{"name":"minTradeThreshold","type":"uint256"},{"name":"tokenTypeForMiningThreshold","type":"uint8"},{"name":"minMiningThreshold","type":"uint256"}]},
{"type":"function","name":"DexFundMarketOwnerConfig", "inputs":[{"name":"operationCode","type":"uint8"},{"name":"tradeToken","type":"tokenId"},{"name":"quoteToken","type":"tokenId"},{"name":"marketOwner","type":"address"},{"name":"takerFeeRate","type":"int32"},{"name":"makerFeeRate","type":"int32"},{"name":"stopMarket","type":"bool"}]},
{"type":"function","name":"DexFundTransferTokenOwner", "inputs":[{"name":"token","type":"tokenId"}, {"name":"newOwner","type":"address"}]},
{"type":"function","name":"NotifyTime", "inputs":[{"name":"timestamp","type":"int64"}]},
{"type":"function","name":"DexFundNewInviter", "inputs":[]},
{"type":"function","name":"DexFundBindInviteCode", "inputs":[{"name":"code","type":"uint32"}]},
{"type":"function","name":"DexFundEndorseVx", "inputs":[]},
{"type":"function","name":"DexFundSettleMakerMinedVx", "inputs":[{"name":"data","type":"bytes"}]},

{"type":"function","name":"DexFundPledgeForSuperVip", "inputs":[{"name":"actionType","type":"uint8"}]},
{"type":"function","name":"DexFundConfigMarketsAgent", "inputs":[{"name":"actionType","type":"uint8"},{"name":"agent","type":"address"},{"name":"tradeTokens","type":"tokenId[]"},{"name":"quoteTokens","type":"tokenId[]"}]},
{"type":"function","name":"DexFundNewAgentOrder", "inputs":[{"name":"principal","type":"address"}, {"name":"tradeToken","type":"tokenId"}, {"name":"quoteToken","type":"tokenId"}, {"name":"side", "type":"bool"}, {"name":"orderType", "type":"uint8"}, {"name":"price", "type":"string"}, {"name":"quantity", "type":"uint256"}]},

{"type":"function","name":"Deposit", "inputs":[]},
{"type":"function","name":"Withdraw", "inputs":[{"name":"token","type":"tokenId"},{"name":"amount","type":"uint256"}]},
{"type":"function","name":"OpenNewMarket", "inputs":[{"name":"tradeToken","type":"tokenId"}, {"name":"quoteToken","type":"tokenId"}]},
{"type":"function","name":"PlaceOrder", "inputs":[{"name":"tradeToken","type":"tokenId"}, {"name":"quoteToken","type":"tokenId"}, {"name":"side", "type":"bool"}, {"name":"orderType", "type":"uint8"}, {"name":"price", "type":"string"}, {"name":"quantity", "type":"uint256"}]},
{"type":"function","name":"SettleOrders", "inputs":[{"name":"data","type":"bytes"}]},
{"type":"function","name":"TriggerPeriodJob", "inputs":[{"name":"periodId","type":"uint64"},{"name":"bizType","type":"uint8"}]},
{"type":"function","name":"StakeForMining", "inputs":[{"name":"actionType","type":"uint8"}, {"name":"amount","type":"uint256"}]},
{"type":"function","name":"StakeForVIP", "inputs":[{"name":"actionType","type":"uint8"}]},
{"type":"function","name":"DelegateStakeCallback", "inputs":[{"name":"stakeAddress","type":"address"},{"name":"beneficiary","type":"address"},{"name":"amount","type":"uint256"},{"name":"bid","type":"uint8"},{"name":"success","type":"bool"}]},
{"type":"function","name":"CancelDelegateStakeCallback", "inputs":[{"name":"stakeAddress","type":"address"},{"name":"beneficiary","type":"address"},{"name":"amount","type":"uint256"},{"name":"bid","type":"uint8"},{"name":"success","type":"bool"}]},
{"type":"function","name":"DexAdminConfig", "inputs":[{"name":"operationCode","type":"uint8"},{"name":"owner","type":"address"},{"name":"timeOracle","type":"address"},{"name":"periodJobTrigger","type":"address"},{"name":"stopDex","type":"bool"},{"name":"makerMiningAdmin","type":"address"},{"name":"maintainer","type":"address"}]},
{"type":"function","name":"TradeAdminConfig", "inputs":[{"name":"operationCode","type":"uint8"},{"name":"tradeToken","type":"tokenId"},{"name":"quoteToken","type":"tokenId"},{"name":"allowMining","type":"bool"},{"name":"newQuoteToken","type":"tokenId"},{"name":"quoteTokenType","type":"uint8"},{"name":"tokenTypeForTradeThreshold","type":"uint8"},{"name":"minTradeThreshold","type":"uint256"},{"name":"tokenTypeForMiningThreshold","type":"uint8"},{"name":"minMiningThreshold","type":"uint256"}]},
{"type":"function","name":"MarketAdminConfig", "inputs":[{"name":"operationCode","type":"uint8"},{"name":"tradeToken","type":"tokenId"},{"name":"quoteToken","type":"tokenId"},{"name":"marketOwner","type":"address"},{"name":"takerFeeRate","type":"int32"},{"name":"makerFeeRate","type":"int32"},{"name":"stopMarket","type":"bool"}]},
{"type":"function","name":"TransferTokenOwnership", "inputs":[{"name":"token","type":"tokenId"}, {"name":"newOwner","type":"address"}]},
{"type":"function","name":"CreateNewInviter", "inputs":[]},
{"type":"function","name":"BindInviteCode", "inputs":[{"name":"code","type":"uint32"}]},
{"type":"function","name":"EndorseVx", "inputs":[]},
{"type":"function","name":"SettleMakerMinedVx", "inputs":[{"name":"data","type":"bytes"}]},

{"type":"function","name":"StakeForSVIP", "inputs":[{"name":"actionType","type":"uint8"}]},
{"type":"function","name":"ConfigMarketAgents", "inputs":[{"name":"actionType","type":"uint8"},{"name":"agent","type":"address"},{"name":"tradeTokens","type":"tokenId[]"},{"name":"quoteTokens","type":"tokenId[]"}]},
{"type":"function","name":"PlaceAgentOrder", "inputs":[{"name":"principal","type":"address"}, {"name":"tradeToken","type":"tokenId"}, {"name":"quoteToken","type":"tokenId"}, {"name":"side", "type":"bool"}, {"name":"orderType", "type":"uint8"}, {"name":"price", "type":"string"}, {"name":"quantity", "type":"uint256"}]},

{"type":"function","name":"LockVxForDividend", "inputs":[{"name":"actionType","type":"uint8"},{"name":"amount","type":"uint256"}]},
{"type":"function","name":"SwitchConfig", "inputs":[{"name":"switchType","type":"uint8"},{"name":"enable","type":"bool"}]},
{"type":"function","name":"StakeForPrincipalSVIP", "inputs":[{"name":"principal","type":"address"}]},
{"type":"function","name":"CancelStakeById", "inputs":[{"name":"id","type":"bytes32"}]},
{"type":"function","name":"StakeForQuotaWithCallbackCallback", "inputs":[{"name":"id","type":"bytes32"},{"name":"success","type":"bool"}]},
{"type":"function","name":"CancelQuotaStakingWithCallbackCallback", "inputs":[{"name":"id","type":"bytes32"},{"name":"success","type":"bool"}]},
{"type":"function","name":"CancelOrderBySendHash", "inputs":[{"name":"sendHash","type":"bytes32"},{"name":"principal","type":"address"},{"name":"tradeToken","type":"tokenId"},{"name":"quoteToken","type":"tokenId"}]},
{"type":"function","name":"CommonAdminConfig", "inputs":[{"name":"operationCode","type":"uint8"},{"name":"tradeToken","type":"tokenId"},{"name":"quoteToken","type":"tokenId"}, {"name":"enable","type":"bool"}, {"name":"value","type":"int32"}, {"name":"amount","type":"uint256"}, {"name":"address","type":"address"}]},

{"type":"function","name":"Transfer", "inputs":[{"name":"target","type":"address"},{"name":"token","type":"tokenId"},{"name":"amount","type":"uint256"}]},
{"type":"function","name":"AgentDeposit", "inputs":[{"name":"beneficiary","type":"address"}]},
{"type":"function","name":"AssignedWithdraw", "inputs":[{"name":"target","type":"address"},{"name":"token","type":"tokenId"},{"name":"amount","type":"uint256"},{"name":"label","type":"bytes"}]}

]
14 changes: 14 additions & 0 deletions testing_v2.12/abi/trade.abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{"type":"function","name":"DexTradeNewOrder", "inputs":[{"name":"data","type":"bytes"}]},
{"type":"function","name":"DexTradeCancelOrder", "inputs":[{"name":"orderId","type":"bytes"}]},
{"type":"function","name":"DexTradeNotifyNewMarket", "inputs":[{"name":"data","type":"bytes"}]},
{"type":"function","name":"DexTradeCleanExpireOrders", "inputs":[{"name":"data","type":"bytes"}]},
{"type":"function","name":"DexTradeCancelOrderByHash", "inputs":[{"name":"sendHash","type":"bytes32"}]},

{"type":"function","name":"PlaceOrder", "inputs":[{"name":"data","type":"bytes"}]},
{"type":"function","name":"CancelOrder", "inputs":[{"name":"orderId","type":"bytes"}]},
{"type":"function","name":"SyncNewMarket", "inputs":[{"name":"data","type":"bytes"}]},
{"type":"function","name":"ClearExpiredOrders", "inputs":[{"name":"data","type":"bytes"}]},
{"type":"function","name":"CancelOrderByTransactionHash", "inputs":[{"name":"sendHash","type":"bytes32"}]},
{"type":"function","name":"InnerCancelOrderBySendHash", "inputs":[{"name":"sendHash","type":"bytes32"}, {"name":"owner","type":"address"}]}
]
Loading

0 comments on commit 982c5ca

Please sign in to comment.