odra icon indicating copy to clipboard operation
odra copied to clipboard

Make livenet work with contracts without events

Open kubaplas opened this issue 1 year ago • 1 comments

Currently, loading a contract which doesn't use CES events panics, because livenet env loads events count internally. This makes impossible testing contracts which don't use CES.

kubaplas avatar Apr 24 '24 13:04 kubaplas

You should remove querying for event count in the register contract method on HostEnv. It should be loaded lazily.

zie1ony avatar May 09 '24 13:05 zie1ony

Steps to reproduce:

  1. Download some casper cep implementation eg https://github.com/casper-ecosystem/cep-78-enhanced-nft
  2. Setup a local network
  3. Deploy a contract manually, without CES support, eg
casper-client put-deploy --node-address http://localhost:11101/rpc/ \
--chain-name "casper-net-1" \
--payment-amount 500000000000 \
--secret-key ./secret_key.pem \
--session-path ./contract.wasm \
--session-arg "collection_name:string='CEP-78-collection'" \
--session-arg "collection_symbol:string='CEP78'" \
--session-arg "total_token_supply:u64='100'" \
--session-arg "ownership_mode:u8='2'" \
--session-arg "nft_kind:u8='1'" \
--session-arg "nft_metadata_kind:u8='0'" \
--session-arg "json_schema:string='nft-schema'" \
--session-arg "identifier_mode:u8='0'" \
--session-arg "metadata_mutability:u8='0'"
  1. Interact with the contract using livenet client.

kpob avatar May 29 '24 09:05 kpob