Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
329 stars 207 forks source link

cosmic-swingset per action metering #8246

Open mhofman opened 1 year ago

mhofman commented 1 year ago

What is the Problem Being Solved?

As part of https://github.com/Agoric/agoric-sdk/issues/7938, cosmic-swingset must reset swingset meters before processing a new action, but not when continuing a previous action that got interrupted because of the block's run policy reaching its limit.

Description of the Design

Security Considerations

None specific to this issue

Scaling Considerations

Prevents runaway execution. Must be careful to chose a value that allows all normal operations

Test Plan

Until we have #8216, we can temporarily patch zoe to only create meters with a hard coded value. This value will only be used for the initial vat creation, until a new action is processed, and thus needs to be high enough to cover startVat. Then we modify the bootstrap test infrastructure to handle resetting meters similarly to how cosmic-swingset would Finally we add a bootstrap test with a faulty contract, assert it gets killed when going in a loop, and verify we can still perform other actions on chain after that.

Upgrade Considerations

None specific to this issue

mhofman commented 1 year ago

As a point of reference, the KREAd launch seem to have used something like 30x the block limit for their core eval and resulting work.