Merged latest upstream changes from ava-labs/subnet-evm v0.7.5 while preserving Lux customizations: - Updated copyright headers to Lux Industries Inc 2025 - Kept Lux branding and network references - Preserved custom Lux configurations - Updated dependencies to latest versions - Removed deprecated files (trie/, core/vm/, etc) - Updated import paths to use go-ethereum libraries where applicable
2.2 KiB
There are some must-be-done changes waiting in the generated file. Each area requiring you to add your code is marked with CUSTOM CODE to make them easy to find and modify. Additionally there are other files you need to edit to activate your precompile. These areas are highlighted with comments "ADD YOUR PRECOMPILE HERE". For testing take a look at other precompile tests in contract_test.go and config_test.go in other precompile folders. See the tutorial in https://docs.lux.network/subnets/hello-world-precompile-tutorial 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- 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`