warp-contracts / warp

An implementation of the Arweave SmartWeave smart contracts protocol.
MIT License
158 stars 44 forks source link

[BUG] - readStateBatch returns null for contract with no interactions #495

Closed dtfiedler closed 10 months ago

dtfiedler commented 10 months ago

Describe the bug readStateBatch returns null for contract with no interactions

To Reproduce Steps to reproduce the behavior.

const pagesPerBatch = 1;
const contract = warp
  .contract(`iQDr9N2VhKISjVnCe_ZwLIE7GUQJ26fG4zEFl0xyKHQ`); // a contract with no interactions
const { cachedValue } = await contract.readStateBatch(pagesPerBatch, undefined, undefined); 
console.log('result', cachedValue);
if (!cachedValue){
  throw new Error('readStateBatch returned null for contract');
}

Expected behavior readStateBatch returns the initial state of the contract if it has no interactions.

Desktop (please complete the following information):

Additional context Recommend removing this check so the contract is evaluated at least once.

ppedziwiatr commented 10 months ago

Fixed in 1.4.32