Closed marslab2022 closed 1 year ago
Also - please upgrade to latest version of warp-contracts.
contract/package.json:
the WarpNodeFactory
from the above error is an old API from versions prior to 1.2.x
Already upgraded Warp version. Please pull latest code.
I've synced the fork, removed the node_modules and package-lock, made a fresh npm install.
Ok, I've had to update the arweave-js lib in the "main" package.json to 1.11.6 (was 1.11.4).
Unfortunatelly now I'm getting:
Please make sure that your example works - and I'm happy to verify it then :-)
Sorry for that, but I missed the step before run ts-node deploy-test-contract.ts
:
contract/
folder and run npm run build:contracts
to build the contracts.Updated in Issue Description. Thanks!
I guess the npm install
is also required in the contract/
(esbuild is added there in package.json).
unfortunatelly, npm install
in the contract/
ends with
unfortunatelly,
npm install
in thecontract/
ends with
Try yarn install
instead?
I've managed to get to the point 6. of your instruction. Point 6. ends with:
Seem not compatible with your Nodejs version(v18.5.0). Could you please downgrade Nodejs to v16.5.0 temporarily?
npm install n -g
sudo n 16.5.0
ok. instead of serve -s build
, I'm running npm start
(serve does not work).
So I've manged to get to the "Test for badcase", point 1.
From what I understand, I should click on the #0
.
When I do that, I end up with:
Yes. If run as 'debug mode' (npm start), this is expected to occur, just refresh the page...
I will fix this issue tomorrow and push to remote branch
Well, I've managed to run this somehow finally.
The last cancel does not work, becaue the transaction returns the error:
{
ISf1w44qF2gz0tqpiEHHzKrLBWLccvaK8tpMuycyocg: 'Internal write auto error for call [{"from":"LxrHDukuBPVPWDJNZ7c_3idfv8VYZbubaXFoG13ig4k","to":"lfZyWX8yZqrDFqAP08UzKJl9Q3SPkuQkFtURQIMXorc","input":{"function":"transfer","pst":"velOzMBlyQMRaMasY9Dt8u3nGlucOoiCLGpIFwqUqXo","target":"B-Th6kkUqCg9w9AhtX91wYNkNFIwP1CTiS-1jABLJjY","qty":3}}]: Internal write auto error for call [{"from":"lfZyWX8yZqrDFqAP08UzKJl9Q3SPkuQkFtURQIMXorc","to":"velOzMBlyQMRaMasY9Dt8u3nGlucOoiCLGpIFwqUqXo","input":{"function":"transfer","target":"B-Th6kkUqCg9w9AhtX91wYNkNFIwP1CTiS-1jABLJjY","qty":3}}]: Caller balance is not defined!'
}
From what I see in the compiled contract code, the cancelOrder
function tries to make a transfer:
It is this transfer that throws this error (the crucial part here is:
[{"from":"lfZyWX8yZqrDFqAP08UzKJl9Q3SPkuQkFtURQIMXorc","to":"velOzMBlyQMRaMasY9Dt8u3nGlucOoiCLGpIFwqUqXo","input":{"function":"transfer","target":"B-Th6kkUqCg9w9AhtX91wYNkNFIwP1CTiS-1jABLJjY","qty":3}}]: Caller balance is not defined!'
i.e. in this case it is a write from contract lfZyWX8yZqrDFqAP08UzKJl9Q3SPkuQkFtURQIMXorc
(the one with
cancelOrder
) to contract velOzMBlyQMRaMasY9Dt8u3nGlucOoiCLGpIFwqUqXo
(no idea what's this contract), with this input:
{"function":"transfer","target":"B-Th6kkUqCg9w9AhtX91wYNkNFIwP1CTiS-1jABLJjY","qty":3}
This call is causing the transfer
function in the velOzMBlyQMRaMasY9Dt8u3nGlucOoiCLGpIFwqUqXo
contract to throw the Caller balance is not defined!
error.
Did you check the Step4 in 'Test for badcase'? In my case, readState returns result without throwing any errors. But in Step 5, it do throw what you show.
I'm referring to what I'm seeing in my test script, that I use to verify the contract state...(which I was also running after each 'cancel'). After 3rd. cancel, it always returns the same, stable result - with the above error.
I really don't want to dig too deep into details of your webapp, but I guess I have no choice... :-) Will further analyse this tomorrow.
Sorry about that, please. I am very puzzled that my unit tests cannot reproduce this problem, everything behaves normally. Below is my test case, and could I take a look at yours? We are analyzing this issue simultaneously.
it('test cont create & cancel orders', async () => {
await Initialize();
await createDedicatedWallet();
const buy = async (qty, price) => {
const dedicatedWalletAddr = (await user1Contract.dryWrite({
function: 'dedicatedWalletStatus',
params: {
owner: user1WalletAddress
}
})).result['dedicatedWallet'];
await user1Kar.writeInteraction({
function: 'transfer',
target: dedicatedWalletAddr,
qty: qty,
});
await mineBlocks(1);
const txId = await user1Contract.writeInteraction({
function: 'createOrder',
params: {
pairId: 0,
direction: 'buy',
price: price
}
});
await mineBlocks(1);
};
const cancelFirstOrder = async () => {
const orderId = (await user1Contract.readState()).state['orderInfos']['0']['orders'][0]['orderId'];
const txId = await user1Contract.writeInteraction({
function: 'cancelOrder',
params: {
pairId: 0,
orderId: orderId
}
});
await mineBlocks(1);
};
await buy(1, 1);
await buy(2, 2);
await buy(3, 3);
await cancelFirstOrder();
await cancelFirstOrder();
await cancelFirstOrder();
expect((await user1Contract.readState()).state['orderInfos']['0']['orders'].length).toEqual(0);
expect((await user1Contract.readState()).state['orderInfos']['0']['currentPrice']).toEqual(undefined);
expect((await user1Tar.currentBalance(user1WalletAddress)).balance).toEqual(10000);
expect((await user2Tar.currentBalance(user2WalletAddress)).balance).toEqual(10000);
expect((await user1Kar.currentBalance(user1WalletAddress)).balance).toEqual(10000);
expect((await user2Kar.currentBalance(user2WalletAddress)).balance).toEqual(10000);
});
Can you please update the repo with:
Also - are you sure that the webapp mines the ArLocal blocks the exact same way as the test does?
I'm dedicated to find the cause of these issue - above things would greatly help.
OK Please be busy with your own things first. We will spend a day or two to sort out these problems and add them to the description.
And - Could you please put your test script? We will analyse the difference first and try to find what was going on. Thanks!
As I wrote, my test script simply checks the contract state - I'm running it after each operation in webapp. It's dead simple:
const thetAR = 'LxrHDukuBPVPWDJNZ7c_3idfv8VYZbubaXFoG13ig4k';
const warp = WarpFactory.forLocal(1984);
const contract = warp.contract(thetAR);
const state = await contract
.setEvaluationOptions({allowUnsafeClient: true, internalWrites: true})
.readState();
console.log('state');
console.dir(state.cachedValue.state, {depth: null});
console.dir(state.cachedValue.errorMessages, {depth: null});
:-)
Btw., you're using the unsafeClient
here - please consider using an unsafeClient as a last resort - as it is very likely that it will break determinism.
Thanks for putting so much time into this issue. The design of our contract is as follows:
Because pst does not have transferFrom
interface like ERC20 tokens, for compatibility consideration, there are two calls of internalWrite
function, i.e. exchange contract -> dedicated wallet -> users' wallet
. The dedicated wallet can be fully controlled by the exchange contract. When a transaction is matched, the dedicated wallet is notified by the exchange contract to make the transaction - transfer to the user's wallet.
But as described in this issue, two evaluations do not match.
We have been actively seeking solutions to this problem in the past few days. After discussion, we have come to the following conclusions:
Thanks again for your help and dedicating to this issue. ❤️
Thanks. I'll still put some more time into it next week, because I've noticed one weird behaviour that bothers me a bit - but there are several possible causes (including some ArLocal quirks).
Simplifying contracts design is always a good choice 👍
I would also suggest checking our ERC20 proposal https://github.com/warp-contracts/wrc/tree/master/contracts/erc20
Thanks. Here's what we found, and hope this can help you:
BUT, when we refresh the page and enter My
, the last order appears again. Check logs:
The logs show that: After I cancelled the 2nd order, the balance in user's wallet is 9998, and in dedicated wallet is 2.
[
"{\"type\":\"fixed_supply\",\"maxSupply\":1000000000,\"ticker\":\"kar\",\"name\":\"kar\",\"owner\":\"9LhSykEGE4LVEM1o2eeZ0hIlzJpr54NPaHM2RQ-FKrE\",\"balances\":{\"9LhSykEGE4LVEM1o2eeZ0hIlzJpr54NPaHM2RQ-FKrE\":9999,\"EKESxPb7dQaD5KA7j-d_y_yA7mn898XO-fDOfFa4-HY\":1}}",
"{\"type\":\"fixed_supply\",\"maxSupply\":1000000000,\"ticker\":\"kar\",\"name\":\"kar\",\"owner\":\"9LhSykEGE4LVEM1o2eeZ0hIlzJpr54NPaHM2RQ-FKrE\",\"balances\":{\"9LhSykEGE4LVEM1o2eeZ0hIlzJpr54NPaHM2RQ-FKrE\":9997,\"EKESxPb7dQaD5KA7j-d_y_yA7mn898XO-fDOfFa4-HY\":3}}",
"{\"type\":\"fixed_supply\",\"maxSupply\":1000000000,\"ticker\":\"kar\",\"name\":\"kar\",\"owner\":\"9LhSykEGE4LVEM1o2eeZ0hIlzJpr54NPaHM2RQ-FKrE\",\"balances\":{\"9LhSykEGE4LVEM1o2eeZ0hIlzJpr54NPaHM2RQ-FKrE\":9994,\"EKESxPb7dQaD5KA7j-d_y_yA7mn898XO-fDOfFa4-HY\":6}}",
"\"9LhSykEGE4LVEM1o2eeZ0hIlzJpr54NPaHM2RQ-FKrE\"",
"1",
"\"G69WcVck1eCCsJfLwE8iughK-sEdlp_qE8AFCdYSgHc\"",
"oncancel: {\"type\":\"fixed_supply\",\"maxSupply\":1000000000,\"ticker\":\"kar\",\"name\":\"kar\",\"owner\":\"9LhSykEGE4LVEM1o2eeZ0hIlzJpr54NPaHM2RQ-FKrE\",\"balances\":{\"9LhSykEGE4LVEM1o2eeZ0hIlzJpr54NPaHM2RQ-FKrE\":9995,\"EKESxPb7dQaD5KA7j-d_y_yA7mn898XO-fDOfFa4-HY\":5}}",
"\"9LhSykEGE4LVEM1o2eeZ0hIlzJpr54NPaHM2RQ-FKrE\"",
"2",
"\"G69WcVck1eCCsJfLwE8iughK-sEdlp_qE8AFCdYSgHc\"",
"oncancel: {\"type\":\"fixed_supply\",\"maxSupply\":1000000000,\"ticker\":\"kar\",\"name\":\"kar\",\"owner\":\"9LhSykEGE4LVEM1o2eeZ0hIlzJpr54NPaHM2RQ-FKrE\",\"balances\":{\"9LhSykEGE4LVEM1o2eeZ0hIlzJpr54NPaHM2RQ-FKrE\":9998,\"EKESxPb7dQaD5KA7j-d_y_yA7mn898XO-fDOfFa4-HY\":2}}"
]
Can you please update the repo with:
- the above test case (the one that is currently in the repo differs from what you've pasted above)
- the fix for Got different evaluated contract states #239 (comment) (each time I'm trying to reproduce the issue from scratch in your webapp, I'm getting this error - finally, after n-th try/refresh it goes through - but that's counter productive...)
- a brief description (in bullet points or whatever) what exactly is going on (in terms of what contracts are used in the scenario and what exact interactions are being made (including the internal calls between contracts) - this would really help me to understand what is going on underneath (from the 'high-level' perspective).
Also - are you sure that the webapp mines the ArLocal blocks the exact same way as the test does?
I'm dedicated to find the cause of these issue - above things would greatly help.
And just fixed the No.2 issue. HERE⬇️ https://github.com/marslab2022/thetar_exchange_alpha
If you have any doubts about the repo or want to know something, please comment here, we will actively cooperate with you to solve this issue.🤝
One question - what is the relation between the contract that the internal write is being made in line 36 (with id state.userInfos[action.caller].dedicatedWallet
)
and the one that the state is being read in line 40 (with address pstAddress
)?
cancelOrder
function being called.No direct relation...
We tried to use ERC-20 standard token in exchange contract. But seems it appears the same issue. REPO here: https://github.com/marslab2022/thetARExchange2 For the same contract code, front-end and the same use case, it worked fine yesterday, but today it ran with different evaluate result. The concrete performance now is:
create order:
{
"sortKey": "000000000278,0000000000000,5450431dee3c697ff159e3566297e913a727fa61d756f005a74dfe804cf2a282",
"cachedValue": {
"state": {
"owner": "JJFq7UFAD-7P4oRV9O6hhmAEeLenrprJja6bxNisIeA",
"feeRatio": 0.03,
"tokenSrcTemplateHashs": [
0
],
"thetarTokenAddress": "HKAScMnrHfibhumyI3DaC855kGIRje3GR84mylO2D9M",
"maxPairId": 0,
"pairInfos": [
{
"pairId": 0,
"tokenAddress": "q0d2sMNkxSHBIcVtRofSGkCZ5SoTqJWZBHgbGVU7P0s",
"logo": "TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ",
"description": "test token",
"name": "TEST token",
"symbol": "TEST",
"decimals": 2
}
],
"userOrders": {
"moGnMJDTFyXZp0kuFKxqI57TlivDSaCk4UfsjVnD97U": {
"0": [
{
"creator": "moGnMJDTFyXZp0kuFKxqI57TlivDSaCk4UfsjVnD97U",
"orderId": "8KIEY03eVHjzdnpQjbMDn-PO0CIc4AllQQPEpH8dSo8",
"direction": "buy",
"quantity": 1,
"price": 1
}
]
}
},
"orderInfos": {
"0": {
"orders": [
{
"creator": "moGnMJDTFyXZp0kuFKxqI57TlivDSaCk4UfsjVnD97U",
"orderId": "8KIEY03eVHjzdnpQjbMDn-PO0CIc4AllQQPEpH8dSo8",
"direction": "buy",
"quantity": 1,
"price": 1
}
]
}
},
"logs": []
},
"validity": {
"MfcWJgngTpi3MnT683zSlrH_H0y24wP3Kt9Rthy8QeI": true,
"8KIEY03eVHjzdnpQjbMDn-PO0CIc4AllQQPEpH8dSo8": true
},
"errorMessages": {}
}
}
refresh page and readState:
{
"sortKey": "000000000278,0000000000000,5450431dee3c697ff159e3566297e913a727fa61d756f005a74dfe804cf2a282",
"cachedValue": {
"state": {
"owner": "JJFq7UFAD-7P4oRV9O6hhmAEeLenrprJja6bxNisIeA",
"feeRatio": 0.03,
"tokenSrcTemplateHashs": [
0
],
"thetarTokenAddress": "HKAScMnrHfibhumyI3DaC855kGIRje3GR84mylO2D9M",
"maxPairId": 0,
"pairInfos": [
{
"pairId": 0,
"tokenAddress": "q0d2sMNkxSHBIcVtRofSGkCZ5SoTqJWZBHgbGVU7P0s",
"logo": "TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ",
"description": "test token",
"name": "TEST token",
"symbol": "TEST",
"decimals": 2
}
],
"userOrders": {},
"orderInfos": {
"0": {
"orders": []
}
},
"logs": []
},
"validity": {
"MfcWJgngTpi3MnT683zSlrH_H0y24wP3Kt9Rthy8QeI": true,
"8KIEY03eVHjzdnpQjbMDn-PO0CIc4AllQQPEpH8dSo8": false
},
"errorMessages": {
"8KIEY03eVHjzdnpQjbMDn-PO0CIc4AllQQPEpH8dSo8": "TypeError: Cannot read properties of undefined (reading 'xJ9SXNlziAAp-RrOMUKLhHDItVYiPuLSRAbtg2Fv5k4')\n at checkOrderQuantity (eval at create (http://localhost:3000/static/js/vendors~main.chunk.js:204937:34), <anonymous>:170:61)\n at async createOrder (eval at create (http://localhost:3000/static/js/vendors~main.chunk.js:204937:34), <anonymous>:141:17)\n at async JsHandlerApi.handle [as contractFunction] (eval at create (http://localhost:3000/static/js/vendors~main.chunk.js:204937:34), <anonymous>:373:16)\n at async JsHandlerApi.handle (http://localhost:3000/static/js/vendors~main.chunk.js:205621:29)\n at async CacheableStateEvaluator.doReadState (http://localhost:3000/static/js/vendors~main.chunk.js:204604:24)\n at async CacheableStateEvaluator.eval (http://localhost:3000/static/js/vendors~main.chunk.js:204148:12)\n at async HandlerBasedContract.callContract (http://localhost:3000/static/js/vendors~main.chunk.js:202304:29)\n at async HandlerBasedContract.dryWrite (http://localhost:3000/static/js/vendors~main.chunk.js:201981:12)\n at async pairInfo (http://localhost:3000/static/js/main.chunk.js:5323:15)\n at async Object.fetchInfos [as submitTask] (http://localhost:3000/static/js/main.chunk.js:2773:25)"
}
}
}
set InMemory
to false
:
const warp = WarpFactory.forLocal(1984, undefined, {inMemory: false});
and contract state is:
{
"sortKey": "000000000278,0000000000000,5450431dee3c697ff159e3566297e913a727fa61d756f005a74dfe804cf2a282",
"cachedValue": {
"state": {
"owner": "JJFq7UFAD-7P4oRV9O6hhmAEeLenrprJja6bxNisIeA",
"feeRatio": 0.03,
"tokenSrcTemplateHashs": [
0
],
"thetarTokenAddress": "HKAScMnrHfibhumyI3DaC855kGIRje3GR84mylO2D9M",
"maxPairId": 0,
"pairInfos": [
{
"pairId": 0,
"tokenAddress": "q0d2sMNkxSHBIcVtRofSGkCZ5SoTqJWZBHgbGVU7P0s",
"logo": "TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ",
"description": "test token",
"name": "TEST token",
"symbol": "TEST",
"decimals": 2
}
],
"userOrders": {
"moGnMJDTFyXZp0kuFKxqI57TlivDSaCk4UfsjVnD97U": {
"0": [
{
"creator": "moGnMJDTFyXZp0kuFKxqI57TlivDSaCk4UfsjVnD97U",
"orderId": "8KIEY03eVHjzdnpQjbMDn-PO0CIc4AllQQPEpH8dSo8",
"direction": "buy",
"quantity": 1,
"price": 1
}
]
}
},
"orderInfos": {
"0": {
"orders": [
{
"creator": "moGnMJDTFyXZp0kuFKxqI57TlivDSaCk4UfsjVnD97U",
"orderId": "8KIEY03eVHjzdnpQjbMDn-PO0CIc4AllQQPEpH8dSo8",
"direction": "buy",
"quantity": 1,
"price": 1
}
]
}
},
"logs": []
},
"validity": {
"MfcWJgngTpi3MnT683zSlrH_H0y24wP3Kt9Rthy8QeI": true,
"8KIEY03eVHjzdnpQjbMDn-PO0CIc4AllQQPEpH8dSo8": true
},
"errorMessages": {}
}
}
And I create another order, I must set InMemory
to true again(Switch to the different state against last time) and I just got expected evaluate result.
{
"sortKey": "000000000280,0000000000000,d0fe39f017e8bad490e846cc993aee2703e07e27dff2dfbed89c13702ac82956",
"cachedValue": {
"state": {
"owner": "JJFq7UFAD-7P4oRV9O6hhmAEeLenrprJja6bxNisIeA",
"feeRatio": 0.03,
"tokenSrcTemplateHashs": [
0
],
"thetarTokenAddress": "HKAScMnrHfibhumyI3DaC855kGIRje3GR84mylO2D9M",
"maxPairId": 0,
"pairInfos": [
{
"pairId": 0,
"tokenAddress": "q0d2sMNkxSHBIcVtRofSGkCZ5SoTqJWZBHgbGVU7P0s",
"logo": "TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ",
"description": "test token",
"name": "TEST token",
"symbol": "TEST",
"decimals": 2
}
],
"userOrders": {
"moGnMJDTFyXZp0kuFKxqI57TlivDSaCk4UfsjVnD97U": {
"0": [
{
"creator": "moGnMJDTFyXZp0kuFKxqI57TlivDSaCk4UfsjVnD97U",
"orderId": "8KIEY03eVHjzdnpQjbMDn-PO0CIc4AllQQPEpH8dSo8",
"direction": "buy",
"quantity": 1,
"price": 1
},
{
"creator": "moGnMJDTFyXZp0kuFKxqI57TlivDSaCk4UfsjVnD97U",
"orderId": "VYtreO_HjCyak7L2DmooBme4Ihi716-3_Gj3dlSq5RQ",
"direction": "buy",
"quantity": 1,
"price": 2
}
]
}
},
"orderInfos": {
"0": {
"orders": [
{
"creator": "moGnMJDTFyXZp0kuFKxqI57TlivDSaCk4UfsjVnD97U",
"orderId": "8KIEY03eVHjzdnpQjbMDn-PO0CIc4AllQQPEpH8dSo8",
"direction": "buy",
"quantity": 1,
"price": 1
},
{
"creator": "moGnMJDTFyXZp0kuFKxqI57TlivDSaCk4UfsjVnD97U",
"orderId": "VYtreO_HjCyak7L2DmooBme4Ihi716-3_Gj3dlSq5RQ",
"direction": "buy",
"quantity": 1,
"price": 2
}
]
}
},
"logs": []
},
"validity": {
"MfcWJgngTpi3MnT683zSlrH_H0y24wP3Kt9Rthy8QeI": true,
"8KIEY03eVHjzdnpQjbMDn-PO0CIc4AllQQPEpH8dSo8": true,
"VYtreO_HjCyak7L2DmooBme4Ihi716-3_Gj3dlSq5RQ": true
},
"errorMessages": {}
}
}
transaction Infos:
[
{
"tx": "8KIEY03eVHjzdnpQjbMDn-PO0CIc4AllQQPEpH8dSo8",
"k_v": {
"Interact-Write": "HKAScMnrHfibhumyI3DaC855kGIRje3GR84mylO2D9M",
"App-Name": "SmartWeaveAction",
"App-Version": "0.3.0",
"SDK": "Warp",
"Contract": "xJ9SXNlziAAp-RrOMUKLhHDItVYiPuLSRAbtg2Fv5k4",
"Input": "{\"function\":\"createOrder\",\"params\":{\"pairId\":0,\"direction\":\"buy\",\"price\":1}}",
"Signing-Client": "ArConnect",
"Signing-Client-Version": "0.5.1"
}
},
{
"tx": "MfcWJgngTpi3MnT683zSlrH_H0y24wP3Kt9Rthy8QeI",
"k_v": {
"App-Name": "SmartWeaveAction",
"App-Version": "0.3.0",
"SDK": "Warp",
"Contract": "xJ9SXNlziAAp-RrOMUKLhHDItVYiPuLSRAbtg2Fv5k4",
"Input": "{\"function\":\"addPair\",\"params\":{\"tokenAddress\":\"q0d2sMNkxSHBIcVtRofSGkCZ5SoTqJWZBHgbGVU7P0s\",\"logo\":\"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ\",\"description\":\"test token\"}}"
}
},
{
"tx": "VYtreO_HjCyak7L2DmooBme4Ihi716-3_Gj3dlSq5RQ",
"k_v": {
"Interact-Write": "HKAScMnrHfibhumyI3DaC855kGIRje3GR84mylO2D9M",
"App-Name": "SmartWeaveAction",
"App-Version": "0.3.0",
"SDK": "Warp",
"Contract": "xJ9SXNlziAAp-RrOMUKLhHDItVYiPuLSRAbtg2Fv5k4",
"Input": "{\"function\":\"createOrder\",\"params\":{\"pairId\":0,\"direction\":\"buy\",\"price\":2}}",
"Signing-Client": "ArConnect",
"Signing-Client-Version": "0.5.1"
}
}
]
Tips: can get contract state by click Refresh
button, will be printed in console:
It seems that the issue is related to the caching mechanism? Please check this, thanks.
Thanks, we will dig into it next week.
All steps to reproduce in the new repo are exactly the same as in the original repo, right?
Also, have you tried to reproduce this in the test, but with a persistent cache?
Removing the whole webapp/GUI layer from the equation would greatly simplify the analysis.
Just keep in mind that (with persistent cache) each consecutive test run will start with different initial conditions.
You can also manually clear the cache in - for example - "afterAll" clause - by simply removing the cache files.
Yes, Steps are same as in original repo.
But I am not sure you will get the same result as what I wrote above. Maybe trigger it requires certain conditions but we did not found yet(Because we encountered this problem after debugging for a few days, it did not appear before).
And we will also try to reproduce this in the tests next week.
Also want to know - What happened when I switch InMemory
option from false
to true
or from true
to false
?
Hi, I have written a test script to reproduce the bad case.
npx arlocal 1984
cd contract/ && yarn install
cd deploy/
ts-node test_badcase.ts
running...
(node:23575) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
{"owner":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"_hmbbbuR_p0y1Tpz5Qm5de1CXpKtxIjYfhkQPC9THfI","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"Laz5XWb04meSdILPMekZbL84j6ORZ9wtB4q3ZBSsRkc","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{},"orderInfos":{"0":{"orders":[]}},"logs":[]}
txid: qTEkbh9C_i1SvPmpTDyQT-SIaXVVwWv8vu0umFSX3yM
wallet address: oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4
create order...
BEFORE: {"sortKey":"000000000181,0000000000000,fed24af03dadac5c866bc92da4ed0244f930b8df172d73fc6054b4b699ef0481","cachedValue":{"state":{"owner":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"_hmbbbuR_p0y1Tpz5Qm5de1CXpKtxIjYfhkQPC9THfI","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"Laz5XWb04meSdILPMekZbL84j6ORZ9wtB4q3ZBSsRkc","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{},"orderInfos":{"0":{"orders":[]}},"logs":[]},"validity":{"iQ60TLK1WU4kre10BeQuI2a151xUfcOIegIzNdk9eis":true},"errorMessages":{}}}
AFTER: {"sortKey":"000000000184,0000000000000,8aa1fad7a2f60ef765a2543e3e9a0b2b90f63b394a8f090fcb14a8197d004b25","cachedValue":{"state":{"owner":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"_hmbbbuR_p0y1Tpz5Qm5de1CXpKtxIjYfhkQPC9THfI","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"Laz5XWb04meSdILPMekZbL84j6ORZ9wtB4q3ZBSsRkc","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4":{"0":[{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50","direction":"buy","quantity":1,"price":1}]}},"orderInfos":{"0":{"orders":[{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50","direction":"buy","quantity":1,"price":1}]}},"logs":[]},"validity":{"iQ60TLK1WU4kre10BeQuI2a151xUfcOIegIzNdk9eis":true,"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50":true},"errorMessages":{}}}
create order...
BEFORE: {"sortKey":"000000000184,0000000000000,8aa1fad7a2f60ef765a2543e3e9a0b2b90f63b394a8f090fcb14a8197d004b25","cachedValue":{"state":{"owner":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"_hmbbbuR_p0y1Tpz5Qm5de1CXpKtxIjYfhkQPC9THfI","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"Laz5XWb04meSdILPMekZbL84j6ORZ9wtB4q3ZBSsRkc","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4":{"0":[{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50","direction":"buy","quantity":1,"price":1}]}},"orderInfos":{"0":{"orders":[{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50","direction":"buy","quantity":1,"price":1}]}},"logs":[]},"validity":{"iQ60TLK1WU4kre10BeQuI2a151xUfcOIegIzNdk9eis":true,"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50":true},"errorMessages":{}}}
AFTER: {"sortKey":"000000000188,0000000000000,af33cd9e53f412a168392dddca21035cdee23c9917977c816b42d60cbe278588","cachedValue":{"state":{"owner":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"_hmbbbuR_p0y1Tpz5Qm5de1CXpKtxIjYfhkQPC9THfI","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"Laz5XWb04meSdILPMekZbL84j6ORZ9wtB4q3ZBSsRkc","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4":{"0":[{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50","direction":"buy","quantity":1,"price":1},{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0","direction":"buy","quantity":1,"price":2}]}},"orderInfos":{"0":{"orders":[{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50","direction":"buy","quantity":1,"price":1},{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0","direction":"buy","quantity":1,"price":2}]}},"logs":[]},"validity":{"iQ60TLK1WU4kre10BeQuI2a151xUfcOIegIzNdk9eis":true,"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50":true,"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0":true},"errorMessages":{}}}
cancel order...
BEFORE: {"sortKey":"000000000188,0000000000000,af33cd9e53f412a168392dddca21035cdee23c9917977c816b42d60cbe278588","cachedValue":{"state":{"owner":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"_hmbbbuR_p0y1Tpz5Qm5de1CXpKtxIjYfhkQPC9THfI","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"Laz5XWb04meSdILPMekZbL84j6ORZ9wtB4q3ZBSsRkc","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4":{"0":[{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50","direction":"buy","quantity":1,"price":1},{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0","direction":"buy","quantity":1,"price":2}]}},"orderInfos":{"0":{"orders":[{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50","direction":"buy","quantity":1,"price":1},{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0","direction":"buy","quantity":1,"price":2}]}},"logs":[]},"validity":{"iQ60TLK1WU4kre10BeQuI2a151xUfcOIegIzNdk9eis":true,"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50":true,"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0":true},"errorMessages":{}}}
AFTER: {"sortKey":"000000000190,0000000000000,89900f9a3840bd32fb89dc4c187e6597b5389719c7e1f6b33da508b0bf449c3a","cachedValue":{"state":{"owner":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"_hmbbbuR_p0y1Tpz5Qm5de1CXpKtxIjYfhkQPC9THfI","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"Laz5XWb04meSdILPMekZbL84j6ORZ9wtB4q3ZBSsRkc","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4":{"0":[{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0","direction":"buy","quantity":1,"price":2}]}},"orderInfos":{"0":{"orders":[{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0","direction":"buy","quantity":1,"price":2}]}},"logs":[]},"validity":{"iQ60TLK1WU4kre10BeQuI2a151xUfcOIegIzNdk9eis":true,"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50":true,"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0":true,"mJ2Nev-Jd7tx5UZsU0rIU48yr5P35cTc1mAHHtzamGI":true},"errorMessages":{}}}
cancel order...
ERROR [DefaultStateEvaluator] Executing of interaction: [qTEkbh9C_i1SvPmpTDyQT-SIaXVVwWv8vu0umFSX3yM -> eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0] threw exception: [
"TypeError: Cannot read properties of undefined (reading 'qTEkbh9C_i1SvPmpTDyQT-SIaXVVwWv8vu0umFSX3yM')\n" +
' at checkOrderQuantity (eval at create (/Users/lab/mARsLab/thetar_exchange2/contract/node_modules/warp-contracts/src/core/modules/impl/HandlerExecutorFactory.ts:194:34), <anonymous>:170:61)\n' +
' at async createOrder (eval at create (/Users/lab/mARsLab/thetar_exchange2/contract/node_modules/warp-contracts/src/core/modules/impl/HandlerExecutorFactory.ts:194:34), <anonymous>:141:17)\n' +
' at async JsHandlerApi.handle [as contractFunction] (eval at create (/Users/lab/mARsLab/thetar_exchange2/contract/node_modules/warp-contracts/src/core/modules/impl/HandlerExecutorFactory.ts:194:34), <anonymous>:373:16)\n' +
' at async JsHandlerApi.handle (/Users/lab/mARsLab/thetar_exchange2/contract/node_modules/warp-contracts/src/core/modules/impl/handler/JsHandlerApi.ts:39:29)\n' +
' at async CacheableStateEvaluator.doReadState (/Users/lab/mARsLab/thetar_exchange2/contract/node_modules/warp-contracts/src/core/modules/impl/DefaultStateEvaluator.ts:196:24)\n' +
' at async CacheableStateEvaluator.eval (/Users/lab/mARsLab/thetar_exchange2/contract/node_modules/warp-contracts/src/core/modules/impl/CacheableStateEvaluator.ts:96:12)\n' +
' at async HandlerBasedContract.readState (/Users/lab/mARsLab/thetar_exchange2/contract/node_modules/warp-contracts/src/contract/HandlerBasedContract.ts:126:20)\n' +
' at async CacheableStateEvaluator.doReadState (/Users/lab/mARsLab/thetar_exchange2/contract/node_modules/warp-contracts/src/core/modules/impl/DefaultStateEvaluator.ts:128:9)\n' +
' at async CacheableStateEvaluator.eval (/Users/lab/mARsLab/thetar_exchange2/contract/node_modules/warp-contracts/src/core/modules/impl/CacheableStateEvaluator.ts:96:12)\n' +
' at async HandlerBasedContract.callContractForTx (/Users/lab/mARsLab/thetar_exchange2/contract/node_modules/warp-contracts/src/contract/HandlerBasedContract.ts:608:29)'
]
BEFORE: {"sortKey":"000000000190,0000000000000,89900f9a3840bd32fb89dc4c187e6597b5389719c7e1f6b33da508b0bf449c3a","cachedValue":{"state":{"owner":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"_hmbbbuR_p0y1Tpz5Qm5de1CXpKtxIjYfhkQPC9THfI","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"Laz5XWb04meSdILPMekZbL84j6ORZ9wtB4q3ZBSsRkc","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4":{"0":[{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0","direction":"buy","quantity":1,"price":2}]}},"orderInfos":{"0":{"orders":[{"creator":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","orderId":"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0","direction":"buy","quantity":1,"price":2}]}},"logs":[]},"validity":{"iQ60TLK1WU4kre10BeQuI2a151xUfcOIegIzNdk9eis":true,"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50":true,"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0":true,"mJ2Nev-Jd7tx5UZsU0rIU48yr5P35cTc1mAHHtzamGI":true},"errorMessages":{}}}
AFTER: {"sortKey":"000000000192,0000000000000,38d6b59008e57fb26f2c26dcda7384a1317961a82882f1865ea697caa7a7f51e","cachedValue":{"state":{"owner":"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"_hmbbbuR_p0y1Tpz5Qm5de1CXpKtxIjYfhkQPC9THfI","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"Laz5XWb04meSdILPMekZbL84j6ORZ9wtB4q3ZBSsRkc","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"oFmwley-WV5EbRZmHXPi_kkXN4N6xCCMzkFF0H1TIk4":{"0":[]}},"orderInfos":{"0":{"orders":[]}},"logs":[]},"validity":{"iQ60TLK1WU4kre10BeQuI2a151xUfcOIegIzNdk9eis":true,"P0el5eE7TsKc0JZYQuffqhiVq-S1Y9WlQXCDQI70o50":true,"eZMpe8-WSB11WeRSLHqHoLmI1yrkt6b0if-raJzC4G0":true,"mJ2Nev-Jd7tx5UZsU0rIU48yr5P35cTc1mAHHtzamGI":true,"D7yfFpw1GCYkHCo32e2kyq3epdQJbURwzp5KXg7Cop8":true},"errorMessages":{}}}
It seems that the final state of contract is expected, but it throws exception before the 2nd cancalOrder
execution.
Could you please analyze this issue via this script?
Thanks! I'll try to return to this issue tomorrow or on Thursday!
Hey @marslab2022, I've looked into the issue. There is a strange behaviour when opening multiple connections to Arlocal from many warp instances. We'll keep exploring this anomaly.
In the meantime please either
Use a single connection to ArLocal, as shown in the forked badexample testcase: https://github.com/marslab2022/thetARExchange2/commit/8985c0dcd4553672a89f73dab5e28c2b3d47ce42#diff-e0dea3dfd9dd07613cf86e572062ddbfed1bade37b678370891a78a3fbc886cb
Use the mainnet environment (at the moment the transactions are still costless): https://github.com/marslab2022/thetARExchange2/commit/8985c0dcd4553672a89f73dab5e28c2b3d47ce42#diff-99404bd04b50162d11881cd0b5593aacf1ca9859103118e93906c50cd227af46
Hey @marslab2022, I've looked into the issue. There is a strange behaviour when opening multiple connections to Arlocal from many warp instances. We'll keep exploring this anomaly.
In the meantime please either
- Use a single connection to ArLocal, as shown in the forked badexample testcase: marslab2022/thetARExchange2@8985c0d#diff-e0dea3dfd9dd07613cf86e572062ddbfed1bade37b678370891a78a3fbc886cb
- Use the mainnet environment (at the moment the transactions are still costless): marslab2022/thetARExchange2@8985c0d#diff-99404bd04b50162d11881cd0b5593aacf1ca9859103118e93906c50cd227af46
Hi, @jakub-wojciechowski . I will try the tests quoted above.
But still have a question: you said opening multiple connections to Arlocal from many warp instances
, does it mean that this anomaly will also be triggered even if multiple warp instances are not connected at the same time? Because in my test script, different warp instances will not exist at the same time. After each function(e.g. createOrder
, cancelOrder
) ends, it will leave the scope and trigger the destructor, I think.
Hi, I suppose the problem is more on the ArLocal side, as we've got multiple of issues with it before. We'll keep investigating it until we've got more clarity what was the exact root cause.
@jakub-wojciechowski Hi, here's the test results:
running...
(node:18051) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
{"owner":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"8iXZOolr6tJSoJ973IdO4XJ3x4x8ImXgnHqqWrTKhWk","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"OnknMBYXMjp_S8lYrONDGFPnkVna8QQ7DSHF08J0_-s","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{},"orderInfos":{"0":{"orders":[]}},"logs":[]}
txid: gP7LRVSLlMQ0lK-ZdtDnWFd8VFNGxRIh0oMdqxHLbZI
wallet address: L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0
create order...
BEFORE: {"sortKey":"000000000002,0000000000000,08be4f5e3c04db3aa4768b93ba163c780ab74c5c315cc355af2464a183a8fc2a","cachedValue":{"state":{"owner":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"8iXZOolr6tJSoJ973IdO4XJ3x4x8ImXgnHqqWrTKhWk","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"OnknMBYXMjp_S8lYrONDGFPnkVna8QQ7DSHF08J0_-s","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{},"orderInfos":{"0":{"orders":[]}},"logs":[]},"validity":{"ZnuS2HoXYN9rlMqkj77QverwmW3PbeN3IhCptCsJfJc":true},"errorMessages":{}}}
AFTER: {"sortKey":"000000000005,0000000000000,d1375f4aa777359c425bd1a4d36b749c7ffb338e9545428c4c0547b7fb9fbebd","cachedValue":{"state":{"owner":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"8iXZOolr6tJSoJ973IdO4XJ3x4x8ImXgnHqqWrTKhWk","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"OnknMBYXMjp_S8lYrONDGFPnkVna8QQ7DSHF08J0_-s","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0":{"0":[{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE","direction":"buy","quantity":1,"price":1}]}},"orderInfos":{"0":{"orders":[{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE","direction":"buy","quantity":1,"price":1}]}},"logs":[]},"validity":{"ZnuS2HoXYN9rlMqkj77QverwmW3PbeN3IhCptCsJfJc":true,"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE":true},"errorMessages":{}}}
create order...
BEFORE: {"sortKey":"000000000005,0000000000000,d1375f4aa777359c425bd1a4d36b749c7ffb338e9545428c4c0547b7fb9fbebd","cachedValue":{"state":{"owner":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"8iXZOolr6tJSoJ973IdO4XJ3x4x8ImXgnHqqWrTKhWk","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"OnknMBYXMjp_S8lYrONDGFPnkVna8QQ7DSHF08J0_-s","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0":{"0":[{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE","direction":"buy","quantity":1,"price":1}]}},"orderInfos":{"0":{"orders":[{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE","direction":"buy","quantity":1,"price":1}]}},"logs":[]},"validity":{"ZnuS2HoXYN9rlMqkj77QverwmW3PbeN3IhCptCsJfJc":true,"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE":true},"errorMessages":{}}}
AFTER: {"sortKey":"000000000009,0000000000000,3a60724497e199547ed0a804bebad8097dcddded841728884f0e3ce4062126f3","cachedValue":{"state":{"owner":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"8iXZOolr6tJSoJ973IdO4XJ3x4x8ImXgnHqqWrTKhWk","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"OnknMBYXMjp_S8lYrONDGFPnkVna8QQ7DSHF08J0_-s","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0":{"0":[{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE","direction":"buy","quantity":1,"price":1},{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw","direction":"buy","quantity":1,"price":2}]}},"orderInfos":{"0":{"orders":[{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE","direction":"buy","quantity":1,"price":1},{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw","direction":"buy","quantity":1,"price":2}]}},"logs":[]},"validity":{"ZnuS2HoXYN9rlMqkj77QverwmW3PbeN3IhCptCsJfJc":true,"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE":true,"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw":true},"errorMessages":{}}}
cancel order...
BEFORE: {"sortKey":"000000000009,0000000000000,3a60724497e199547ed0a804bebad8097dcddded841728884f0e3ce4062126f3","cachedValue":{"state":{"owner":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"8iXZOolr6tJSoJ973IdO4XJ3x4x8ImXgnHqqWrTKhWk","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"OnknMBYXMjp_S8lYrONDGFPnkVna8QQ7DSHF08J0_-s","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0":{"0":[{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE","direction":"buy","quantity":1,"price":1},{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw","direction":"buy","quantity":1,"price":2}]}},"orderInfos":{"0":{"orders":[{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE","direction":"buy","quantity":1,"price":1},{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw","direction":"buy","quantity":1,"price":2}]}},"logs":[]},"validity":{"ZnuS2HoXYN9rlMqkj77QverwmW3PbeN3IhCptCsJfJc":true,"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE":true,"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw":true},"errorMessages":{}}}
AFTER: {"sortKey":"000000000011,0000000000000,900c0ff6e164ee8201bd646f97b09112a54f06b8a4411332402d720d45ae4d22","cachedValue":{"state":{"owner":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"8iXZOolr6tJSoJ973IdO4XJ3x4x8ImXgnHqqWrTKhWk","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"OnknMBYXMjp_S8lYrONDGFPnkVna8QQ7DSHF08J0_-s","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0":{"0":[{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw","direction":"buy","quantity":1,"price":2}]}},"orderInfos":{"0":{"orders":[{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw","direction":"buy","quantity":1,"price":2}]}},"logs":[]},"validity":{"ZnuS2HoXYN9rlMqkj77QverwmW3PbeN3IhCptCsJfJc":true,"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE":true,"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw":true,"bjPkJHcRVB2VXAmA2kBYzK3O2lnTajU3brNDDWQspCo":true},"errorMessages":{}}}
cancel order...
BEFORE: {"sortKey":"000000000011,0000000000000,900c0ff6e164ee8201bd646f97b09112a54f06b8a4411332402d720d45ae4d22","cachedValue":{"state":{"owner":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"8iXZOolr6tJSoJ973IdO4XJ3x4x8ImXgnHqqWrTKhWk","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"OnknMBYXMjp_S8lYrONDGFPnkVna8QQ7DSHF08J0_-s","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0":{"0":[{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw","direction":"buy","quantity":1,"price":2}]}},"orderInfos":{"0":{"orders":[{"creator":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","orderId":"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw","direction":"buy","quantity":1,"price":2}]}},"logs":[]},"validity":{"ZnuS2HoXYN9rlMqkj77QverwmW3PbeN3IhCptCsJfJc":true,"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE":true,"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw":true,"bjPkJHcRVB2VXAmA2kBYzK3O2lnTajU3brNDDWQspCo":true},"errorMessages":{}}}
AFTER: {"sortKey":"000000000013,0000000000000,819f33b0cc3384d5f716c6a7e8d17a7232a2ec18068bc9938a03074086ca346c","cachedValue":{"state":{"owner":"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0","feeRatio":0.03,"tokenSrcTemplateHashs":[0],"thetarTokenAddress":"8iXZOolr6tJSoJ973IdO4XJ3x4x8ImXgnHqqWrTKhWk","maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"OnknMBYXMjp_S8lYrONDGFPnkVna8QQ7DSHF08J0_-s","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"userOrders":{"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0":{"0":[]}},"orderInfos":{"0":{"orders":[]}},"logs":[]},"validity":{"ZnuS2HoXYN9rlMqkj77QverwmW3PbeN3IhCptCsJfJc":true,"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE":true,"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw":true,"bjPkJHcRVB2VXAmA2kBYzK3O2lnTajU3brNDDWQspCo":true,"4JCaaSQ2qqnRElF5S3Uo532cMcU9hf090rl6fkzCaJ8":true},"errorMessages":{}}}
Contract: {
"sortKey": "000000000013,0000000000000,819f33b0cc3384d5f716c6a7e8d17a7232a2ec18068bc9938a03074086ca346c",
"cachedValue": {
"state": {
"owner": "L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0",
"feeRatio": 0.03,
"tokenSrcTemplateHashs": [
0
],
"thetarTokenAddress": "8iXZOolr6tJSoJ973IdO4XJ3x4x8ImXgnHqqWrTKhWk",
"maxPairId": 0,
"pairInfos": [
{
"pairId": 0,
"tokenAddress": "OnknMBYXMjp_S8lYrONDGFPnkVna8QQ7DSHF08J0_-s",
"logo": "TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ",
"description": "test token",
"name": "TEST token",
"symbol": "TEST",
"decimals": 2
}
],
"userOrders": {
"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0": {
"0": []
}
},
"orderInfos": {
"0": {
"orders": []
}
},
"logs": []
},
"validity": {
"ZnuS2HoXYN9rlMqkj77QverwmW3PbeN3IhCptCsJfJc": true,
"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE": true,
"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw": true,
"bjPkJHcRVB2VXAmA2kBYzK3O2lnTajU3brNDDWQspCo": true,
"4JCaaSQ2qqnRElF5S3Uo532cMcU9hf090rl6fkzCaJ8": true
},
"errorMessages": {}
}
}
Token:
{
"sortKey": "000000000013,0000000000000,819f33b0cc3384d5f716c6a7e8d17a7232a2ec18068bc9938a03074086ca346c",
"cachedValue": {
"state": {
"symbol": "TAR",
"name": "ThetAR exchange token",
"decimals": 2,
"totalSupply": 20000,
"balances": {
"L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0": 10000
},
"allowances": {},
"owner": "L6QCMjqSMzHXb5504eFkkrQSh0JJmrWbDWscXaiXsg0",
"evolve": "",
"canEvolve": true
},
"validity": {
"ftUWq5R3TyXvWqfQhsKZXAmhriapsM6Z2SaU9jdiPBk": true,
"-NeBWyhY2wmclabbk-3chIWBTBAFbSohkF5307ncdZE": true,
"oZiOVzBKiXCe3mTCmmCg5I3qgM8Il3H_7p0Wukt0I4E": true,
"j8894c3o2UhWo5hja6-pN3PUL1VLjuoPI9wGGU-7dgw": true,
"bjPkJHcRVB2VXAmA2kBYzK3O2lnTajU3brNDDWQspCo": true,
"4JCaaSQ2qqnRElF5S3Uo532cMcU9hf090rl6fkzCaJ8": true
},
"errorMessages": {}
}
}
INFO [LevelDbCache] Using location ./cache/warp/state []
running...
(node:16512) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
{"logs":[],"owner":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","feeRatio":0.03,"maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"r3zUor0sThpE37GGe4_8H3_qWf7XCi0K-NByQOEgHpk","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"orderInfos":{"0":{"orders":[]}},"userOrders":{},"thetarTokenAddress":"XSYh9oTtE8VVuTRSQ8N_JQuPDgBIZDcgESnRmRzbPcM","tokenSrcTemplateHashs":[0]}
txid: o9WdVvRYK58xWiRi6u-rF-R2VPhtq9xD6TJskhlQTPg
wallet address: g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg
create order...
BEFORE: {"sortKey":"000001053629,1667973013898,12398a3d0132b61974416d131356ffd7c0936e4ef22ce55ffa075a5bf0d55e1b","cachedValue":{"state":{"logs":[],"owner":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","feeRatio":0.03,"maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"r3zUor0sThpE37GGe4_8H3_qWf7XCi0K-NByQOEgHpk","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"orderInfos":{"0":{"orders":[]}},"userOrders":{},"thetarTokenAddress":"XSYh9oTtE8VVuTRSQ8N_JQuPDgBIZDcgESnRmRzbPcM","tokenSrcTemplateHashs":[0]},"validity":{"ZoVXUlqA7LnEIoASGDtnpLS19V_UmYDmeOu-NpiuGec":true},"errorMessages":{}}}
AFTER: {"sortKey":"000001053629,1667973030032,f55ace38c2fe79b7fce98f6bc89f6cdf502dbb5f88e1bbad715d14da96d282e6","cachedValue":{"state":{"logs":[],"owner":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","feeRatio":0.03,"maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"r3zUor0sThpE37GGe4_8H3_qWf7XCi0K-NByQOEgHpk","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"orderInfos":{"0":{"orders":[{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y","direction":"buy","quantity":1,"price":1}]}},"userOrders":{"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg":{"0":[{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y","direction":"buy","quantity":1,"price":1}]}},"thetarTokenAddress":"XSYh9oTtE8VVuTRSQ8N_JQuPDgBIZDcgESnRmRzbPcM","tokenSrcTemplateHashs":[0]},"validity":{"ZoVXUlqA7LnEIoASGDtnpLS19V_UmYDmeOu-NpiuGec":true,"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y":true},"errorMessages":{}}}
create order...
BEFORE: {"sortKey":"000001053629,1667973030032,f55ace38c2fe79b7fce98f6bc89f6cdf502dbb5f88e1bbad715d14da96d282e6","cachedValue":{"state":{"logs":[],"owner":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","feeRatio":0.03,"maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"r3zUor0sThpE37GGe4_8H3_qWf7XCi0K-NByQOEgHpk","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"orderInfos":{"0":{"orders":[{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y","direction":"buy","quantity":1,"price":1}]}},"userOrders":{"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg":{"0":[{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y","direction":"buy","quantity":1,"price":1}]}},"thetarTokenAddress":"XSYh9oTtE8VVuTRSQ8N_JQuPDgBIZDcgESnRmRzbPcM","tokenSrcTemplateHashs":[0]},"validity":{"ZoVXUlqA7LnEIoASGDtnpLS19V_UmYDmeOu-NpiuGec":true,"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y":true},"errorMessages":{}}}
AFTER: {"sortKey":"000001053629,1667973047432,49c0f62a97611aae9500195f01e0d612924eac3cc55d8bb0c3dc4eb6b5a5e72d","cachedValue":{"state":{"logs":[],"owner":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","feeRatio":0.03,"maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"r3zUor0sThpE37GGe4_8H3_qWf7XCi0K-NByQOEgHpk","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"orderInfos":{"0":{"orders":[{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y","direction":"buy","quantity":1,"price":1},{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs","direction":"buy","quantity":1,"price":2}]}},"userOrders":{"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg":{"0":[{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y","direction":"buy","quantity":1,"price":1},{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs","direction":"buy","quantity":1,"price":2}]}},"thetarTokenAddress":"XSYh9oTtE8VVuTRSQ8N_JQuPDgBIZDcgESnRmRzbPcM","tokenSrcTemplateHashs":[0]},"validity":{"ZoVXUlqA7LnEIoASGDtnpLS19V_UmYDmeOu-NpiuGec":true,"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y":true,"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs":true},"errorMessages":{}}}
cancel order...
BEFORE: {"sortKey":"000001053629,1667973047432,49c0f62a97611aae9500195f01e0d612924eac3cc55d8bb0c3dc4eb6b5a5e72d","cachedValue":{"state":{"logs":[],"owner":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","feeRatio":0.03,"maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"r3zUor0sThpE37GGe4_8H3_qWf7XCi0K-NByQOEgHpk","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"orderInfos":{"0":{"orders":[{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y","direction":"buy","quantity":1,"price":1},{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs","direction":"buy","quantity":1,"price":2}]}},"userOrders":{"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg":{"0":[{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y","direction":"buy","quantity":1,"price":1},{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs","direction":"buy","quantity":1,"price":2}]}},"thetarTokenAddress":"XSYh9oTtE8VVuTRSQ8N_JQuPDgBIZDcgESnRmRzbPcM","tokenSrcTemplateHashs":[0]},"validity":{"ZoVXUlqA7LnEIoASGDtnpLS19V_UmYDmeOu-NpiuGec":true,"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y":true,"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs":true},"errorMessages":{}}}
AFTER: {"sortKey":"000001053630,1667973064681,fcbef64051ceec0a8e4b33482b31b1be428087da68a688a4cfa531e56675a331","cachedValue":{"state":{"logs":[],"owner":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","feeRatio":0.03,"maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"r3zUor0sThpE37GGe4_8H3_qWf7XCi0K-NByQOEgHpk","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"orderInfos":{"0":{"orders":[{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs","direction":"buy","quantity":1,"price":2}]}},"userOrders":{"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg":{"0":[{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs","direction":"buy","quantity":1,"price":2}]}},"thetarTokenAddress":"XSYh9oTtE8VVuTRSQ8N_JQuPDgBIZDcgESnRmRzbPcM","tokenSrcTemplateHashs":[0]},"validity":{"ZoVXUlqA7LnEIoASGDtnpLS19V_UmYDmeOu-NpiuGec":true,"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y":true,"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs":true,"y3Ql-RJcUOL2e5-Tub4cw39-d_bU73RoFvVRsZrfzWQ":true},"errorMessages":{}}}
cancel order...
BEFORE: {"sortKey":"000001053630,1667973064681,fcbef64051ceec0a8e4b33482b31b1be428087da68a688a4cfa531e56675a331","cachedValue":{"state":{"logs":[],"owner":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","feeRatio":0.03,"maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"r3zUor0sThpE37GGe4_8H3_qWf7XCi0K-NByQOEgHpk","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"orderInfos":{"0":{"orders":[{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs","direction":"buy","quantity":1,"price":2}]}},"userOrders":{"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg":{"0":[{"creator":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","orderId":"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs","direction":"buy","quantity":1,"price":2}]}},"thetarTokenAddress":"XSYh9oTtE8VVuTRSQ8N_JQuPDgBIZDcgESnRmRzbPcM","tokenSrcTemplateHashs":[0]},"validity":{"ZoVXUlqA7LnEIoASGDtnpLS19V_UmYDmeOu-NpiuGec":true,"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y":true,"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs":true,"y3Ql-RJcUOL2e5-Tub4cw39-d_bU73RoFvVRsZrfzWQ":true},"errorMessages":{}}}
AFTER: {"sortKey":"000001053630,1667973079007,1463909005ff50d06101f6d084d7ab66c9f9fff1cc96c2cde24fef104a3df707","cachedValue":{"state":{"logs":[],"owner":"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg","feeRatio":0.03,"maxPairId":0,"pairInfos":[{"pairId":0,"tokenAddress":"r3zUor0sThpE37GGe4_8H3_qWf7XCi0K-NByQOEgHpk","logo":"TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ","description":"test token","name":"TEST token","symbol":"TEST","decimals":2}],"orderInfos":{"0":{"orders":[]}},"userOrders":{"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg":{"0":[]}},"thetarTokenAddress":"XSYh9oTtE8VVuTRSQ8N_JQuPDgBIZDcgESnRmRzbPcM","tokenSrcTemplateHashs":[0]},"validity":{"ZoVXUlqA7LnEIoASGDtnpLS19V_UmYDmeOu-NpiuGec":true,"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y":true,"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs":true,"y3Ql-RJcUOL2e5-Tub4cw39-d_bU73RoFvVRsZrfzWQ":true,"M5z_6N-X-Wan8CwTcPoFdCEjXcRCGlWjeMW9GznOeLc":true},"errorMessages":{}}}
Contract: {
"sortKey": "000001053630,1667973079007,1463909005ff50d06101f6d084d7ab66c9f9fff1cc96c2cde24fef104a3df707",
"cachedValue": {
"state": {
"logs": [],
"owner": "g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg",
"feeRatio": 0.03,
"maxPairId": 0,
"pairInfos": [
{
"pairId": 0,
"tokenAddress": "r3zUor0sThpE37GGe4_8H3_qWf7XCi0K-NByQOEgHpk",
"logo": "TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ",
"description": "test token",
"name": "TEST token",
"symbol": "TEST",
"decimals": 2
}
],
"orderInfos": {
"0": {
"orders": []
}
},
"userOrders": {
"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg": {
"0": []
}
},
"thetarTokenAddress": "XSYh9oTtE8VVuTRSQ8N_JQuPDgBIZDcgESnRmRzbPcM",
"tokenSrcTemplateHashs": [
0
]
},
"validity": {
"ZoVXUlqA7LnEIoASGDtnpLS19V_UmYDmeOu-NpiuGec": true,
"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y": true,
"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs": true,
"y3Ql-RJcUOL2e5-Tub4cw39-d_bU73RoFvVRsZrfzWQ": true,
"M5z_6N-X-Wan8CwTcPoFdCEjXcRCGlWjeMW9GznOeLc": true
},
"errorMessages": {}
}
}
Token:
{
"sortKey": "000001053630,1667973079007,1463909005ff50d06101f6d084d7ab66c9f9fff1cc96c2cde24fef104a3df707",
"cachedValue": {
"state": {
"symbol": "TAR",
"name": "ThetAR exchange token",
"decimals": 2,
"totalSupply": 20000,
"balances": {
"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg": 10000
},
"allowances": {},
"owner": "g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg",
"evolve": "",
"canEvolve": true
},
"validity": {
"O5IZA8RL3UPi2xIU8MfAwkqYRj7hHrYcTSPX3h70ND4": true,
"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y": true,
"dPsCbqJQ_dSGAwaNQ_zd0zItXGa7CQZ9UaKh9LkH5ps": true,
"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs": true,
"y3Ql-RJcUOL2e5-Tub4cw39-d_bU73RoFvVRsZrfzWQ": true,
"M5z_6N-X-Wan8CwTcPoFdCEjXcRCGlWjeMW9GznOeLc": true
},
"errorMessages": {}
}
}
And got the same error when testing with GUI in mainnet.
contract id: o9WdVvRYK58xWiRi6u-rF-R2VPhtq9xD6TJskhlQTPg
transaction id which is not expected: aiR6S_NAKKbQ8BZL4EWh5e22yCN-gkjsQ5A2va3s5MY
readState result:
{
"sortKey": "000001053679,1667979395295,9b6a78a66a52501f4d791f178f4fb134369c5ffa65faddecaaaef2f082bc4f9a",
"cachedValue": {
"state": {
"logs": [],
"owner": "g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg",
"feeRatio": 0.03,
"maxPairId": 0,
"pairInfos": [
{
"pairId": 0,
"tokenAddress": "r3zUor0sThpE37GGe4_8H3_qWf7XCi0K-NByQOEgHpk",
"logo": "TEST_00000lQgApM_a3Z6bGFHYE7SXnBI6C5_2_24MQ",
"description": "test token",
"name": "TEST token",
"symbol": "TEST",
"decimals": 2
}
],
"orderInfos": {
"0": {
"orders": []
}
},
"userOrders": {
"g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg": {
"0": []
}
},
"thetarTokenAddress": "XSYh9oTtE8VVuTRSQ8N_JQuPDgBIZDcgESnRmRzbPcM",
"tokenSrcTemplateHashs": [
0
]
},
"validity": {
"ZoVXUlqA7LnEIoASGDtnpLS19V_UmYDmeOu-NpiuGec": true,
"CfCueGL0DAcEYXNynH7tTlhDiiJmni9kdSb0VvxH61Y": true,
"m7XWJlXyw9LTj85uM49JRH4-ieD4NItuA--zW2aszcs": true,
"y3Ql-RJcUOL2e5-Tub4cw39-d_bU73RoFvVRsZrfzWQ": true,
"M5z_6N-X-Wan8CwTcPoFdCEjXcRCGlWjeMW9GznOeLc": true,
"aiR6S_NAKKbQ8BZL4EWh5e22yCN-gkjsQ5A2va3s5MY": false
},
"errorMessages": {
"aiR6S_NAKKbQ8BZL4EWh5e22yCN-gkjsQ5A2va3s5MY": "TypeError: Cannot read properties of undefined (reading 'o9WdVvRYK58xWiRi6u-rF-R2VPhtq9xD6TJskhlQTPg')\n at checkOrderQuantity (eval at create (http://localhost:3000/static/js/vendors~main.chunk.js:204937:34), <anonymous>:170:61)\n at async createOrder (eval at create (http://localhost:3000/static/js/vendors~main.chunk.js:204937:34), <anonymous>:141:17)\n at async JsHandlerApi.handle [as contractFunction] (eval at create (http://localhost:3000/static/js/vendors~main.chunk.js:204937:34), <anonymous>:373:16)\n at async JsHandlerApi.handle (http://localhost:3000/static/js/vendors~main.chunk.js:205621:29)\n at async CacheableStateEvaluator.doReadState (http://localhost:3000/static/js/vendors~main.chunk.js:204604:24)\n at async CacheableStateEvaluator.eval (http://localhost:3000/static/js/vendors~main.chunk.js:204148:12)\n at async HandlerBasedContract.callContract (http://localhost:3000/static/js/vendors~main.chunk.js:202304:29)\n at async HandlerBasedContract.dryWrite (http://localhost:3000/static/js/vendors~main.chunk.js:201981:12)\n at async orderInfo (http://localhost:3000/static/js/main.chunk.js:5603:15)"
}
}
}
Hi, team. Is there any pathway to fix this issue now? :-)
Hi, we haven't forgotten about it and it. It'll require a bit more of investigation and we can dedicate some time towards it at the end of the week. Sorry, for keeping you waiting.
Hey, one thing that we noticed in your contract is reading the state:
after the contract was modified a few lines above in: https://github.com/marslab2022/thetARExchange2/blob/main/contract/src/thetAR/actions/write/createOrder.ts#L38
This is an anti-patters and could bring corrupted results as the state that is being read might be stale. The correct approach should be getting the updated state after performing a write operation.
let updatedState = await SmartWeave.contracts.write //use updateState.state.balances instead of await SmartWeave.contracts.readContractState
However, there are still some issues with the contract execution that we're investigating so stay tuned...
Thank you very much for your reminder and suggestion. We will continue to check for contract code and update it. :)
Hey @marslab2022 . After fixing the issue with the contract that Kuba have mentioned - can you please perform further tests with evaluationOptions.updateCacheForEachInteraction
flag set to true
?
There's definitely sth. wrong with evaluating the state on a fresh client (when multiple inner calls between contracts are being made) when this flag is set to false
.
I will continue to analyse the issue.
Yes, we will temporarily keep this switch to true
. Thank you all for putting valuable time into this issue. Please let me know if this issue is fixed, thanks.
Hey @marslab2022 , I know it's been a while, but we finally have a new, refactored version of the internal writes (https://github.com/warp-contracts/warp/pull/311) and I would love to test the current version of your contracts with this refactored version of the SDK...can you please provide a link to the current version?
Thank you for your continued follow-up on this issue. We have updated the contract code, the latest code can be found here: https://github.com/marslab2022/ThetARExchange/tree/main/contract/src/thetAR If you encounter problems with the code during testing, please leave a comment :-).
Hi, team. I got different evaluated contract states when integrate contract to DApp - The result of two calls to the function
readState
is not the same. Could team please check this? Thanks.Test environment preparation
Clone code to local: https://github.com/marslab2022/ThetAR_exchange
Cmd:
npm install
Cmd:
npx arlocal 1984
Head to
contract/
folder and runyarn install
&npm run build:contracts
. Then, tocontract/deploy/
folder, and run command:ts-node deploy-test-contract.ts
It will shows: And generate a JWK file: key-file-for-test.jsonHead to file:
src/lib/api.js
.ReplacethetARContractAddress
with txid. ReplacefeeWalletAdrress
withwallet address
generated below(step 4).Cmd:
npm run build
Cmd:
serve -s build
Head to
localhost:3000
Connect wallet using
key-file-for-test.json
generated in step 4.Go to
my
page and clickregister
;Refresh page and click
activate
:Test for badcase
Click
home
botton and enter #0 pair detailsCreate 3 orders:
Head to
My
page and cancel these 3 orders respectively:Check the console log: After click
cancel
button, print the newest contract state to console. Check the last state, we can find userInfos->orders is Array(0), means no remaining orders.Go to
Home
page and click#0
, you could find order: And when clickRefresh
button, it will print contract state to console. Check it:The order that had been cancelled came back???