Use of default SlotConfig in awaitTime of PAB ContractInstance requestHandler
etiennejf opened this issue · comments
Summary
The use of the default SlotConfig
in awaitTime
function defined in Plutus.PAB.Core.ContractInstance.STM
may impact script validation when running PAB with a private testnet such that, the beginning of slot zero and the slot length may not correspond to the default public testnet configuration. Indeed, pscSlotConfig
specified in the nodeServerConfig
must be considered instead.
Steps to reproduce the behavior
- Define an endpoint calling
awaitTime 0
and perform atell
on the result - Invoke the endpoint with a PAB context running a fresh instance of a local testnet
- Check the observable state of the corresponding contract instance.
Actual Result
The produced POSIXTime will differ from the local testnet slotconfig.
Expected Result
The produced POSIXTime should be in conformity with the local testnet slotconfig.
Describe the approach you would take to fix this
Any BlockchainEvent request to a contract instance must be parameterized with the node configuration.
A current workaround is to explicitly pass the slotConfig to the invoked endpoint and replicate what awaitTime does.
System info
plutus commit : 51da951
FYI: Here is the approach the Marlowe team has temporarily taken to work around the POSIXTime issues: 0a19f75.
Yes that's the main idea, but instead of using a global reference, I've implemented a wrapper function that passes the node parameters (e.g., protocol parameters, slotConfig and networkId) to each invoked endpoints. This allows to have customized libs without disruption anything.
Thanks for reporting!