From 5b75de47f3d520c2ad62d0fd804fc38fd6f1a13c Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Thu, 29 Feb 2024 18:32:26 +0100 Subject: [PATCH] add event to readme (#1110) --- cmd/precompilegen/template-readme.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cmd/precompilegen/template-readme.md b/cmd/precompilegen/template-readme.md index d81e622b2b..09aa152658 100644 --- a/cmd/precompilegen/template-readme.md +++ b/cmd/precompilegen/template-readme.md @@ -5,19 +5,21 @@ For testing take a look at other precompile tests in contract_test.go and config See the tutorial in for more information about precompile development. General guidelines for precompile development: + 1- Set a suitable config key in generated module.go. E.g: "yourPrecompileConfig" 2- Read the comment and set a suitable contract address in generated module.go. E.g: ContractAddress = common.HexToAddress("ASUITABLEHEXADDRESS") 3- It is recommended to only modify code in the highlighted areas marked with "CUSTOM CODE STARTS HERE". Typically, custom codes are required in only those areas. Modifying code outside of these areas should be done with caution and with a deep understanding of how these changes may impact the EVM. -4- Set gas costs in generated contract.go -5- Force import your precompile package in precompile/registry/registry.go -6- Add your config unit tests under generated package config_test.go -7- Add your contract unit tests under generated package contract_test.go -8- Additionally you can add a full-fledged VM test for your precompile under plugin/vm/vm_test.go. See existing precompile tests for examples. -9- Add your solidity interface and test contract to contracts/contracts -10- Write solidity contract tests for your precompile in contracts/contracts/test -11- Write TypeScript DS-Test counterparts for your solidity tests in contracts/test -12- Create your genesis with your precompile enabled in tests/precompile/genesis/ -13- Create e2e test for your solidity test in tests/precompile/solidity/suites.go -14- Run your e2e precompile Solidity tests with './scripts/run_ginkgo.sh` +4- If you have any event defined in your precompile, review the generated event.go file and set your event gas costs. You should also emit your event in your function in the contract.go file. +5- Set gas costs in generated contract.go +6- Force import your precompile package in precompile/registry/registry.go +7- Add your config unit tests under generated package config_test.go +8- Add your contract unit tests under generated package contract_test.go +9- Additionally you can add a full-fledged VM test for your precompile under plugin/vm/vm_test.go. See existing precompile tests for examples. +10- Add your solidity interface and test contract to contracts/contracts +11- Write solidity contract tests for your precompile in contracts/contracts/test +12- Write TypeScript DS-Test counterparts for your solidity tests in contracts/test +13- Create your genesis with your precompile enabled in tests/precompile/genesis/ +14- Create e2e test for your solidity test in tests/precompile/solidity/suites.go +15- Run your e2e precompile Solidity tests with './scripts/run_ginkgo.sh`