Closed marslab2022 closed 1 year ago
@marslab2022 , can you please test locally on SDK 1.2.53 with the same evaluation options as DRE is using:
@marslab2022 , can you please test locally on SDK 1.2.53 with the same evaluation options as DRE is using:
@ppedziwiatr Hey, I tried to run with v1.2.53 and reproduced this issue. And evaluation options are the same with v1.2.17.
Option:
internalWrites: true,
useVM2: true
Error:
{
"version": "v1",
"code": 200,
"data": {
"sortKey": "000001166436,1682496501870,88f9f67b10ae86cf8508c567579beb84bc9a3d23c401ccecdabd66b751cf568d",
"cachedValue": {
"state": {
"owner": "g-HsAODsIOoTG4MgvmeOTmqyA_RKMupujUuok-nrmkg",
"poured": 90000000,
"tokenAddress": "-0pqJNz8YeOcffdf4DSiauthfWiGcOKzs61sI2-xF7E"
},
"validity": {
"29jug5F_9n5Ewf-PayB451YvilCIGa5_1haE8SRARog": true,
"SmH5VH1Ky8j9-dT-oZO4f6qG8sHKY47mLY1qA2cb5uE": true,
"kCGC059BTpzaRwQtnM9t8okoHXu0x-Ixr0CV5nvh3XU": true,
"jWQ7LFxW4zEuhbrGqQTCD-pcBKIsXKslQrvac8k4c-Q": true,
"GvDy1QQvpWcXViQUlLhD3GjNkqCjFSRGEnaWuhAGlUg": true,
"06kqsv_6djR6mgSzvQUI0iz1TkcETWe67Of0gFwfOzo": true,
"ejg8Sc0af1CgrH_mi_-v9ZQArwshz3TqzwqDEMYnlkA": true,
"RRCHlQ8Y8WI87MVZBSAlqUmwVL2KnbhwFzNFIuGluVI": true,
"kbFb2u_85Yv0-tymez572ety3rNnEzpl6g8v6lDSkR0": true,
"GApVvSgVWw3g5YV-6AoViIpo76jY3KOCZfGyIC9WHcE": false,
"thqRS-HfLGPBc9WIdv7TyWiRHTtxj3E49dyz1_DS7U8": false,
"oNDgRXzDmOMSmcfVJgWQGUnd1OQcAnP3k4TmMVnrc5s": false,
"C6_7PKd7P7AssZshD-3Zt8l4gxgjG_Fpk7F6SDkU1IA": false,
"KCBb-zkKgG-MLfzA9LoufRhY0TY0p7Kh_Sf5NvqzRyk": false,
"y9VybweRVGD1IU3UCDef8bTPrF9yws6z2omaVvL5A8Q": false,
"FHBgnk2Y4vM2BI2y2I4CgG71F928pD6zOMvCoCEn31w": false,
"Evxt6ZOmQx1DqxCLe2a4L0yySKrTTJB_ImMwemdS3DI": false,
"uijtrV80HHusUXui1vk1KIHhefbOprNYYG4cga49ey0": false,
"uns_BKEZF-zxHCkEbXPDsSt0n0GAfbqdlJ5MQ89sjMw": false,
"U1PVI26Zg5L0YT5zLXot9r7bVY2WYZQPVSxCw5gc51w": false,
"aACayFoW9ghnmJdx7PKFhPWlHLapvL_JgsanUNTr2SM": false,
"zjAkuhbVUsqAjdWxUT8fNp8Gb7PQw4tTzXMD_ko2YEw": false
},
"errorMessages": {
"GApVvSgVWw3g5YV-6AoViIpo76jY3KOCZfGyIC9WHcE": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)",
"thqRS-HfLGPBc9WIdv7TyWiRHTtxj3E49dyz1_DS7U8": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)",
"oNDgRXzDmOMSmcfVJgWQGUnd1OQcAnP3k4TmMVnrc5s": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)",
"C6_7PKd7P7AssZshD-3Zt8l4gxgjG_Fpk7F6SDkU1IA": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)",
"KCBb-zkKgG-MLfzA9LoufRhY0TY0p7Kh_Sf5NvqzRyk": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)",
"y9VybweRVGD1IU3UCDef8bTPrF9yws6z2omaVvL5A8Q": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)",
"FHBgnk2Y4vM2BI2y2I4CgG71F928pD6zOMvCoCEn31w": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)",
"Evxt6ZOmQx1DqxCLe2a4L0yySKrTTJB_ImMwemdS3DI": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)",
"uijtrV80HHusUXui1vk1KIHhefbOprNYYG4cga49ey0": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)",
"uns_BKEZF-zxHCkEbXPDsSt0n0GAfbqdlJ5MQ89sjMw": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)",
"U1PVI26Zg5L0YT5zLXot9r7bVY2WYZQPVSxCw5gc51w": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)",
"aACayFoW9ghnmJdx7PKFhPWlHLapvL_JgsanUNTr2SM": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)",
"zjAkuhbVUsqAjdWxUT8fNp8Gb7PQw4tTzXMD_ko2YEw": "TypeError: Cannot read properties of undefined (reading 'startsWith')\n at Object.swGlobal.contracts.readContractState (/root/mars_dre_node/node_modules/warp-contracts/lib/cjs/core/modules/impl/handler/AbstractContractHandler.js:97:42)"
}
}
}
}
Thanks, we will take a look!
hmm, cannot reproduce, neither on the current version, nor on 1.2.53
const contract = warp.contract<any>("gp9ElQmOf0tCy-tIUPaftAXzi0jtroQTmlYUMwqoDo0")
.setEvaluationOptions({
internalWrites: true,
useVM2: true
});
anyway, we will be making more tests...
hmm, cannot reproduce, neither on the current version, nor on 1.2.53
const contract = warp.contract<any>("gp9ElQmOf0tCy-tIUPaftAXzi0jtroQTmlYUMwqoDo0") .setEvaluationOptions({ internalWrites: true, useVM2: true });
anyway, we will be making more tests...
This is original Repo, hope it helps.
Thanks, I'm further analyzing the issue.
Ok, I think I know what is causing the issue - it seems to be the LmdbCache implementation. If we use the default LevelDB - it works fine.
We will investigate further why Lmdb is causing issues in this case. cc @Tadeuchi - MRE, uncomment the useStateCache to get errors like:
const { LmdbCache } = require('warp-contracts-lmdb');
const { defaultCacheOptions, WarpFactory, LoggerFactory } = require('warp-contracts');
const { EvaluationProgressPlugin } = require("warp-contracts-evaluation-progress-plugin");
const { NlpExtension } = require("warp-contracts-plugin-nlp");
const { EvmSignatureVerificationServerPlugin } = require("warp-contracts-plugin-signature/server");
const { EthersExtension } = require("warp-contracts-plugin-ethers");
const { VM2Plugin } = require("warp-contracts-plugin-vm2");
const { VRFPlugin } = require("warp-contracts-plugin-vrf");
const { ContractBlacklistPlugin, getDreBlacklistFunction } = require("warp-contracts-plugin-blacklist");
const { getFailures, connect, events } = require("../db/nodeDb");
const { config } = require("../config");
const { EventEmitter } = require("node:events");
(async () => {
LoggerFactory.INST.logLevel("debug");
const contractTxId = 'gp9ElQmOf0tCy-tIUPaftAXzi0jtroQTmlYUMwqoDo0'
const eventEmitter = new EventEmitter();
eventEmitter.on('progress-notification', (data) => {
events.progress(data.contractTxId, data.message);
});
const warp = WarpFactory.forMainnet()
/*.useStateCache(
new LmdbCache(
{
...defaultCacheOptions,
dbLocation: `./cache/warp/lmdb/state`
},
{
minEntriesPerContract: 5,
maxEntriesPerContract: 20
}
)
)*/
.useContractCache(
new LmdbCache(
{
...defaultCacheOptions,
dbLocation: `./cache/warp/lmdb/contract`
},
{
minEntriesPerContract: 1,
maxEntriesPerContract: 5
}
),
new LmdbCache(
{
...defaultCacheOptions,
dbLocation: `./cache/warp/lmdb/source`
},
{
minEntriesPerContract: 1,
maxEntriesPerContract: 5
}
)
)
.useKVStorageFactory(
(contractTxId) =>
new LmdbCache(
{
...defaultCacheOptions,
dbLocation: `./cache/warp/kv/lmdb/${contractTxId}`
},
{
minEntriesPerContract: 3,
maxEntriesPerContract: 10
}
)
);
warp.whoAmI = 'DRE';
const contract = warp.contract(contractTxId)
.setEvaluationOptions({
internalWrites: true
});
const result = await contract.readState();
console.dir(result.cachedValue.validity);
})();
Fixed in 1.4.8. We will be upgrading DRE nodes soon to this version and we will also add an option to reevaluate the contract on the DRE from scratch.
Describe the bug I deployed a contract to mainnet and found nearly all transactions are invalid evaluated by DRE node(https://sonar.warp.cc/#/app/contract/gp9ElQmOf0tCy-tIUPaftAXzi0jtroQTmlYUMwqoDo0#), but on my local machine, they are valid transactions, I use warp sdk version v1.2.17 locally.
error message:
callee contract ID: "-0pqJNz8YeOcffdf4DSiauthfWiGcOKzs61sI2-xF7E"
To Reproduce
Just call
writeInteraction
function with input:Expected behavior No Errors
Screenshots
Desktop (please complete the following information):
Additional context Add any other context about the problem here.