2

I have implemented a gas-station for my project. When i tried to pay gas for a cont type txn, and it threw me Inside an exec error.

(defcap GAS_PAYER:bool
    ( user:string
      limit:integer
      price:decimal
    )
    (enforce (= "exec" (at "tx-type" (read-msg))) "Inside an exec")
    (enforce (= 1 (length (at "exec-code" (read-msg)))) "Tx of only one pact function")
    (enforce (= "(free.anedak." (take 13 (at 0 (at "exec-code" (read-msg))))) "only free.anedak smart contract")
    (compose-capability (ALLOW_GAS))
  )

While looking at the code, I found that only exec type transactions are supported in gas-stations and the ability to check that the txn call is made only by my contract is only possible in exec type txns.

The data to check for module name and txn types are added in this block of code.

https://github.com/kadena-io/chainweb-node/blob/0b24dd35a7fda27719ea7a2ca54db2cfd1196d95/src/Chainweb/Pact/TransactionExec.hs#L876.

I don't think i can use the existing props for checking the module name in cont type txns.

https://github.com/kadena-io/chainweb-node/blob/8c32fcfff85c4e5b61a9554f0180ca6c90840e42/test/pact/continuation-gas-payer.pact I found this one for cont type txns, but no checks on module name. Any solutions on how i can check the module-name in cont type txns will be helpful as this will prevent my gas-station from spamming.

bart
  • 21
  • 4

0 Answers0