You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Continuation from this ticket.
This ticket comes directly as an action point from #190.
Context and recap
We are currently using an isolated foucoco-based runtime for wasm-deploy testings. This variant of the runtime allows us to skip blocks for testing purposes by calling a modified pallet contracts which in turns modifies the reported block number that the contracts see.
We want to remove this extra repository and have this functionality on the main Foucoco repository itself.
Solution to explore
We would like to create a new pallet that would be conditionally compiled with a test feature flag (or equivalent). This pallet will have at least one extrinsic, which will not take fee nor check signature, that will set the desired block we would like the chain to report during contracts execution.
For this, we can leverage the on_initialize hook. When called, we will store the current block number and then call directly the set_block_numbermethod of the frame system pallet and set it to the desired value.
Then, when on_finalize is called, this pallet should revert the changes done on the frame system pallet. The idea is that only during execution of extrinsic the block reported is different to what it should actually be, and does not interfere with production of blocks. See the lifecycle of hooks and extrinsics for context.
Since this will likely introduce an issue with the validity of any transaction made whenever the block has been changed (see this comment for more details), we need to modify the instances were wasm-deploy submits extrinsics to the chain such that the transaction is specified as Immortal. The calls are formed here and here either for deployment or call to an existing contract. Since api-solang already allows for specifying a modifyExtrinsicfunction, this would be a good place modify the transaction from Mortal to Immortal.
Testing
Ultimately, we are currently using the functionality to skip blocks here. Once the new solution is in place, we should be able to modify the skipBlock function so it calls the new pallet and test if the solution works.
The text was updated successfully, but these errors were encountered:
Continuation from this ticket.
This ticket comes directly as an action point from #190.
Context and recap
We are currently using an isolated foucoco-based runtime for wasm-deploy testings. This variant of the runtime allows us to skip blocks for testing purposes by calling a modified pallet contracts which in turns modifies the reported block number that the contracts see.
We want to remove this extra repository and have this functionality on the main Foucoco repository itself.
Solution to explore
We would like to create a new pallet that would be conditionally compiled with a
test
feature flag (or equivalent). This pallet will have at least one extrinsic, which will not take fee nor check signature, that will set the desired block we would like the chain to report during contracts execution.For this, we can leverage the
on_initialize
hook. When called, we will store the current block number and then call directly theset_block_number
method of the frame system pallet and set it to the desired value.Then, when
on_finalize
is called, this pallet should revert the changes done on the frame system pallet. The idea is that only during execution of extrinsic the block reported is different to what it should actually be, and does not interfere with production of blocks. See the lifecycle of hooks and extrinsics for context.Since this will likely introduce an issue with the validity of any transaction made whenever the block has been changed (see this comment for more details), we need to modify the instances were wasm-deploy submits extrinsics to the chain such that the transaction is specified as
Immortal
. The calls are formed here and here either for deployment or call to an existing contract. Sinceapi-solang
already allows for specifying amodifyExtrinsic
function, this would be a good place modify the transaction fromMortal
toImmortal
.Testing
Ultimately, we are currently using the functionality to skip blocks here. Once the new solution is in place, we should be able to modify the
skipBlock
function so it calls the new pallet and test if the solution works.The text was updated successfully, but these errors were encountered: