Evm automation feature implementation#23
Conversation
* add customization required for evm automation * rm some spaces and cleanup
… use it in other places
-added test cases for deployContract
…e_to_revm Add tx hash precompile to revm at 0x53555001
-removed BlockBasedCounter -updated BlockMeta with deregister and enumerableSet -updated testcases
* added smart contracts, scripts and tests for multisig * -fixed deployContract to allow deployment using multisig as msg.sender -added test cases for deployContract * added test cases for receive * -resolved PR comments * moved Counter to tests * Renamed solidity/automation_registry -> solidity/supra_contracts * Added missing files for build and tests * updated .gitignore and import statment in test file * updated Counter and tests associated with it * added transaction deletion * updated to remove expired txs * renamed test cases --------- Co-authored-by: Aregnaz Harutyunyan <>
* added smart contracts, scripts and tests for multisig * -fixed deployContract to allow deployment using multisig as msg.sender -added test cases for deployContract * added test cases for receive * -resolved PR comments * moved Counter to tests * Renamed solidity/automation_registry -> solidity/supra_contracts * Added missing files for build and tests * added erc20Supra smart contract and test cases * moved SC and tests to supra_contracts * updated .gitignore and import statment in test file * updated .gitignore and added deployment script * renamed test file * renamed events and functions * updated Counter and tests associated with it * updated comments * added transaction deletion * updated to remove expired txs * renamed test cases --------- Co-authored-by: Aregnaz Harutyunyan <>
BlockMeta Smart Contract
* added function nativeToErc20SupraWithAllowance * added test cases for nativeToErc20SupraWithAllowance * added param allowanceAmount to nativeToErc20SupraWithAllowance * fixed test cases
…tomation registry (#5) * added smart contracts, libraries for automation registry * added test cases for registry and controller smart contract * fixed variable naming, replaced modifier with pvt function * -created script to deploy automation registry contracts and initialise state -created bash script for deployment and interacting to registry contracts * Moved automation registry implementation to supra_contracts * removed blockmeta address from controller variable name fixes * -added value in payload -added priority and task type in parameters -updated test cases * added access list in payload * fixes for enabling/disbaling automation * fixed test cases involving automation disable * renamed CommonUtils to LibCommonUtils * renamed LibCommonUtils to CommonUtils * fixed test cases * separated the config and deposit logic from AutomationRegistry to AutomationCore updated scripts * fixed test cases * updated scripts * updated scripts and README * removed coldWallet * fixed validation to check if caller is AutomationCore * fixed refundTaskFees and added test cases for AutomationController * updated script and fixed bugs * updated storage layout and implemented relevant changes for it * moved cycle info in AutomationCore * updated test cases * moved cycleInfo to AutomationController * -added view funcitons for cycle details -gas optimization * Small cosmentic changes after review * -updated register function -removed access control for external view functions -updated lockedFeeForNextCycle to depositFee * updated libraries * updated readTxHash * added mockCall for readTxHash --------- Co-authored-by: Aregnaz Harutyunyan <> Co-authored-by: Aregnaz Harutyunyan <89187359+aregng@users.noreply.github.com>
* [EAN-Issue-2529] Added automation and block metadata transactions
* Added missing files
* Implemeted Typed2718 for new transction types
* Implemented Transaction trait for the newly introduced transactions
* Fixed reserved address start
* Updated supra-extension build to utilize forge sources rather than command
* Disabled main logic of supra-extensions bindings generation
- If needed it should be enabled and generated manually
* Updated a comment
* Addressed review comments
* [EAN-Issue-2520] Added logic to validate txn caller address
- Introduced ExecutionMode describing the context of the vm for the
transaction being executed
- Extended Handler with validate_caller() which validates caller address
based on the transaction execution mode.
- System transaction caller is expected to be VM_SIGNER reserved address
- All User/Automated transactions having any of the supra reserved as
caller will fail validation
---------
Co-authored-by: Aregnaz Harutyunyan <>
…xtension contracts (#14) * [EAN-Issue-2629] Means to generate transaction data to deploy supra-extension contracts - Updated ExecutionMode with Genesis variant to allow conventional contract deployment for genesis supra-extension contracts. - Updated supra-extension build script to have contracts compiled - Added GenesisTransactionGenerator which generates transactions to set up - Foundation multisig wallet - Erc20Supra contract - BlockMeta - AutomationRegistry contracts * Addressed review comments * Added automation registry contracts to genesis set * Cosmetic changes --------- Co-authored-by: Aregnaz Harutyunyan <>
…te viewer requirements (#17) Co-authored-by: Aregnaz Harutyunyan <>
…-automation flow in supra-chain (#18) * [EAN-Issue-2528] Updated supra-contract bindings to meat registry state viewer requirements * [EAN-Issue-2531] Updated supra-extensions and bindings to support evm-automation flow in supra-chain - Added helper solidity scripts to prerform governance actions for localnet * Addressed review comments * Added automation task payload data type * Pointed gmp-mpfr-sys to EntropyFoundation fork * Added constructor for TaskPayload --------- Co-authored-by: Aregnaz Harutyunyan <>
…source (#20) This will help to generate genesis contracts regardless whether the compiled contracts output is available or not, as the bytecodes will be already embedded and be part of the binary Co-authored-by: Aregnaz Harutyunyan <>
* [Evm-Issue-2527] Updated transaction fee deduction logic - Now if execution mode is gas-less, then no execution fee is deducted from users account and no refunds are applied after execution - Updated AutomatedTransaction builder to have 0 gas-price in case of it is built based on the gas-less automation task * Updated helper scripts with new actions and gst task registration * Addressed review comments --------- Co-authored-by: Aregnaz Harutyunyan <>
* refactored to use diamond proxy * minor fixes * refactored code * updated scripts * refactored * fix to remove task if insufficient allowance while bookkeeping * updated unlockDepositAndCycleFee * updated Diamond to not receive native tokens * resolved PR comments * fixed cancel task and stop task * updated run.sh for cance task * updated AppStorage: using mapping in place of inner structs * -Separated conversion logic to ERC20SupraHandler from ERC20Supra -Resolved PR comments * - renamed getUserTasks => getTasksByAddress - removed setErc20Supra, setVmSigner * - removed nativToErc20SupraWithAllowance - added mapping for authorised addresses with mint/burn capabilities * Added changes for predicate * resolved PR comments * - resolved PR comments - changed cli script to python while using cast - fixed test cases * - renamed nativeToErc20Supra -> deposit, erc20SupraToNative -> withdraw * bug fixes * renamed burn to burnFrom * added getCycleStateDetails to coreFacet * added burn in ERC20Supra and its test cases * resolved pr comments * fixed task removal and refund due to predicate failure * fixed transition to suspended state when cycle_state == FINISHED, automation_feature == false * merged feature/evm_automation * resolved PR comments * removed comments for TODOs * added helper functions for assertions
…egistry and supra-nove genesis deployment (#21) * [EAN-Issue-2531] Updated supra-extensions to support new automation-registry and supra-nove genesis deployment * Updated Diamond initialization logic to be part of the contract constructor - This allows to not have any extra action to be done after the contract is deployed during genesis - Fixed the tests accordingly - Updated genesis transaction generation flow accordingly * Updated genesis transaction to facilitate move gov-proposal generation * Fixed compile errors after rebase * Reverted removeRegisteredTasks to be single task based * Fixed Diamond constructor in generator * Updated supra-nove repo url * Fixed path * Made supra nova contracts repo as submodule * Fixed errors after rebase --------- Co-authored-by: Aregnaz Harutyunyan <>
* [EAN-Issue-2648] Automation task support with separate predicate - Updated automated transaction type to include separate predicate if specified by user - Added automation record variant allowing to remove the tasks from registry upon system request * Fixed errors and addressed comments - Fixed task predicate payload decoding issue - Updated AutomationRecordAction::Remove to be single task based --------- Co-authored-by: Aregnaz Harutyunyan <>
* Updated AutomationRecordAction and added unit tests * Addressed review comments and fixed initialization flow - Now cycle index for automation record will be specified along with action parameters - Fixed property order in InitParams to match the one defined in contract - Added isInitialized binding to check automation registry initialization status * Remove hardcoded password from script --------- Co-authored-by: Aregnaz Harutyunyan <>
isaacdoidge
left a comment
There was a problem hiding this comment.
A few comments and questions, most minor. I haven't spent much time with Solidity so haven't focused closely on the implementation of the contracts.
| /// Transaction hash (32 bytes). | ||
| /// | ||
| /// Note : Common field for all transactions. | ||
| fn tx_hash(&self) -> B256; |
There was a problem hiding this comment.
If this field is derived then it would be useful to add a comment here explaining that. End users should not be able to set this field directly.
| fn set_spec(&mut self, spec: <CTX::Cfg as Cfg>::Spec) -> bool; | ||
|
|
||
| /// Run the precompile. | ||
| /// Run precompile. |
There was a problem hiding this comment.
The previous phasing was correct.
| /// Run precompile. | |
| /// Run the precompile. |
| /// The init-code of the default CREATE2 FACTORY widely used in community | ||
| /// Retrieved from https://github.com/Arachnid/deterministic-deployment-proxy | ||
| pub const CREATE2_FACTORY_CODE: &[u8] = &hex!( | ||
| "604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3" |
There was a problem hiding this comment.
| "604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3" |
| #forge = { git = "https://github.com/foundry-rs/foundry.git", tag="v1.4.1"} | ||
| #alloy-chains = { version = "0.2.13" } | ||
| #shlex = { version = "1.3.0" } |
| url = https://github.com/foundry-rs/forge-std | ||
| [submodule "solidity/supranova"] | ||
| path = solidity/supranova | ||
| url = ssh://git@github.com/Entropy-Foundation/supranova-contracts-private.git |
There was a problem hiding this comment.
This is a private repo. Is any of the code currently leaking into this one? If we want to keep this dependency then we need to provide a way for users to access the compiled code from this repo without exposing the source code. Otherwise, we need to consider splitting the related code out into another private repo (since I'm guessing it's just related to genesis, we should be able to do this).
| import {LibUtils} from "./libraries/LibUtils.sol"; | ||
| import {IBlockMeta} from "./interfaces/IBlockMeta.sol"; | ||
|
|
||
| contract BlockMeta is OwnableUpgradeable, UUPSUpgradeable, IBlockMeta { |
There was a problem hiding this comment.
Can you please explain a bit about what this contract does?
|
|
||
| /// @notice Emitted when the full execution order is replaced. | ||
| /// @param executionOrder Updated array of packed execution entries. | ||
| event ExecutionOrderUpdated(uint256[] indexed executionOrder); |
There was a problem hiding this comment.
What is the execution order for? Will this affect the implementation of our parallel executor?
| #forge = { workspace = true } | ||
| #clap = { workspace = true } | ||
| #shlex = { workspace = true } |
| pub enum AutomationTaskPredicate { | ||
| /// Represents always true predicate | ||
| #[default] | ||
| ByPass, |
There was a problem hiding this comment.
This should be one word:
| ByPass, | |
| Bypass, |
| use primitives::TxKind; | ||
|
|
||
| /// EVM system transaction generated based on the block sent for execution. | ||
| /// Will trigger `BlockMeta::block_prologue` supra-evm SC API execution to meat |
There was a problem hiding this comment.
| /// Will trigger `BlockMeta::block_prologue` supra-evm SC API execution to meat | |
| /// Will trigger `BlockMeta::block_prologue` supra-evm SC API execution to meet |
No description provided.