Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EVM BlockHandler #1864

Merged
merged 10 commits into from
Apr 6, 2023
Merged

Add EVM BlockHandler #1864

merged 10 commits into from
Apr 6, 2023

Conversation

shohamc1
Copy link
Contributor

@shohamc1 shohamc1 commented Apr 5, 2023

Summary

  • Adds a BlockHandler to store EVM block data
  • Create new Handlers struct to act as gateway for multiple handlers (EVMHandler, BlockHandler, etc.)
  • Mock getBlockByHash RPC

@shohamc1 shohamc1 changed the base branch from master to feature/evm April 5, 2023 07:41
@prasannavl prasannavl added the evm label Apr 5, 2023
@prasannavl prasannavl merged commit 3e943f9 into feature/evm Apr 6, 2023
@prasannavl prasannavl deleted the feature/evm_blocks branch April 6, 2023 03:41
@canonbrother canonbrother mentioned this pull request Apr 6, 2023
98 tasks
canonbrother pushed a commit that referenced this pull request Apr 10, 2023
* Make handlers extensible, add block handler

* Move EVMHandler

* Fix build errors

* Add connect_block

* Fix Eth_GetBlockByHash

* Fix incomplete merge

* Add bin files to gitignore

* Change RPC methods to lowerCamelCase

* Formatting
prasannavl added a commit that referenced this pull request Apr 10, 2023
* add ci for evm

* toolchain nightly will do

* add cargo clippy ci

* Add EVM BlockHandler (#1864)

* Make handlers extensible, add block handler

* Move EVMHandler

* Fix build errors

* Add connect_block

* Fix Eth_GetBlockByHash

* Fix incomplete merge

* Add bin files to gitignore

* Change RPC methods to lowerCamelCase

* Formatting

* EVM in/out refinements (#1865)

* Return error on sub balance failure.

* Change to expected return type

* Update EVM in/out TX

* Use array instead of rust::Vec

* Pass context to CustomTxVisit

* Add temporary state to TransactionQueue

* Improve readability

* Block integration test

---------

Co-authored-by: Bushstar <[email protected]>
Co-authored-by: Prasanna Loganathar <[email protected]>

* Revert "EVM in/out refinements (#1865)" (#1867)

This reverts commit 35c85d4.

* EVM in/out refinements  (#1868)

* Return error on sub balance failure.

* Change to expected return type

* Update EVM in/out TX

* Use array instead of rust::Vec

* Pass context to CustomTxVisit

* Add temporary state to TransactionQueue

* Improve readability

* Block integration test

---------

Co-authored-by: Bushstar <[email protected]>

* Fix warnings (#1869)

* Got correct hash for public key recovery. Add test. (#1870)

* Got correct hash for public key recovery. Add test.

* Add support for EIP1559 TXs address recovery

* Add support for EIP2930 TXs address recovery

* Add failing test

* Improve error handling (#1872)

* Improve error handling

* Correct test addresses

* Fix public key extraction from Eth TXs and add tests (#1875)

* Get correct hash for public key recovery. Add test.

* Update test for EIP-2930

* EVM block integration test (#1874)

* Add smart contract create && call tests

* evm ci event triggered by path

* fmt

---------

Co-authored-by: Shoham Chakraborty <[email protected]>
Co-authored-by: Jouzo <[email protected]>
Co-authored-by: Bushstar <[email protected]>
Co-authored-by: Prasanna Loganathar <[email protected]>
prasannavl added a commit that referenced this pull request Jun 9, 2023
* Fix EthSyncingResult proto message (#1853)

* Add EVM block header to coinbase (#1859)

* Add context calls for EVM block creation

* Add update_state bool

* Add context discard

* Return vector of vectors

* Vector of vectors unsupported

* Add EVM context to ConnectBlock

* Add TransactionQueueMap and rough finalize_block

* Add EVM header to coinbase

* Add call to get key from wallets

* Send encoded block header

* Remove evm_add_balance dummy call

* Remove comment

* Fix tests

---------

Co-authored-by: Bushstar <[email protected]>

* Adding evm feature flag and chain id (#1849)

* Add EVM BlockHandler (#1864)

* Make handlers extensible, add block handler

* Move EVMHandler

* Fix build errors

* Add connect_block

* Fix Eth_GetBlockByHash

* Fix incomplete merge

* Add bin files to gitignore

* Change RPC methods to lowerCamelCase

* Formatting

* EVM in/out refinements (#1865)

* Return error on sub balance failure.

* Change to expected return type

* Update EVM in/out TX

* Use array instead of rust::Vec

* Pass context to CustomTxVisit

* Add temporary state to TransactionQueue

* Improve readability

* Block integration test

---------

Co-authored-by: Bushstar <[email protected]>
Co-authored-by: Prasanna Loganathar <[email protected]>

* Revert "EVM in/out refinements (#1865)" (#1867)

This reverts commit 35c85d4.

* EVM in/out refinements  (#1868)

* Return error on sub balance failure.

* Change to expected return type

* Update EVM in/out TX

* Use array instead of rust::Vec

* Pass context to CustomTxVisit

* Add temporary state to TransactionQueue

* Improve readability

* Block integration test

---------

Co-authored-by: Bushstar <[email protected]>

* Fix warnings (#1869)

* Got correct hash for public key recovery. Add test. (#1870)

* Got correct hash for public key recovery. Add test.

* Add support for EIP1559 TXs address recovery

* Add support for EIP2930 TXs address recovery

* Add failing test

* Improve error handling (#1872)

* Improve error handling

* Correct test addresses

* Fix public key extraction from Eth TXs and add tests (#1875)

* Get correct hash for public key recovery. Add test.

* Update test for EIP-2930

* EVM block integration test (#1874)

* Add smart contract create && call tests

* chore(workflow): evm ci (#1866)

* add ci for evm

* toolchain nightly will do

* add cargo clippy ci

* Add EVM BlockHandler (#1864)

* Make handlers extensible, add block handler

* Move EVMHandler

* Fix build errors

* Add connect_block

* Fix Eth_GetBlockByHash

* Fix incomplete merge

* Add bin files to gitignore

* Change RPC methods to lowerCamelCase

* Formatting

* EVM in/out refinements (#1865)

* Return error on sub balance failure.

* Change to expected return type

* Update EVM in/out TX

* Use array instead of rust::Vec

* Pass context to CustomTxVisit

* Add temporary state to TransactionQueue

* Improve readability

* Block integration test

---------

Co-authored-by: Bushstar <[email protected]>
Co-authored-by: Prasanna Loganathar <[email protected]>

* Revert "EVM in/out refinements (#1865)" (#1867)

This reverts commit 35c85d4.

* EVM in/out refinements  (#1868)

* Return error on sub balance failure.

* Change to expected return type

* Update EVM in/out TX

* Use array instead of rust::Vec

* Pass context to CustomTxVisit

* Add temporary state to TransactionQueue

* Improve readability

* Block integration test

---------

Co-authored-by: Bushstar <[email protected]>

* Fix warnings (#1869)

* Got correct hash for public key recovery. Add test. (#1870)

* Got correct hash for public key recovery. Add test.

* Add support for EIP1559 TXs address recovery

* Add support for EIP2930 TXs address recovery

* Add failing test

* Improve error handling (#1872)

* Improve error handling

* Correct test addresses

* Fix public key extraction from Eth TXs and add tests (#1875)

* Get correct hash for public key recovery. Add test.

* Update test for EIP-2930

* EVM block integration test (#1874)

* Add smart contract create && call tests

* evm ci event triggered by path

* fmt

---------

Co-authored-by: Shoham Chakraborty <[email protected]>
Co-authored-by: Jouzo <[email protected]>
Co-authored-by: Bushstar <[email protected]>
Co-authored-by: Prasanna Loganathar <[email protected]>

* chore(evm): add `eth_call` & `eth_getBalance` tests (#1858)

* eth_call from and to are mandatory field

* expose evm ExitReason and ExitSucceed

* add should_call_evm test

* add should_call test

* add should_get_balance test

* rm println and unuse assert

* fix tests

* fmt

* fix(evm): revert `from` `to` back to optional (#1881)

* revert from,to to optional in ethtxinfo

* fmt

* Cleanup directory structure (#1883)

* Add auth for EvmOut transfer balance (#1850)

* Do auth on EvmOut wtih DFI equivalent

* Add authorization for EvmOut with equivalent DFI address of ETH address

* evm: Connect and store blocks (#1882)

* Store ethereum blocks in BlockManager

* Update ffi call

* eth_blockNumber and eth_getBlockByCount implementations

* formatting

* Fix hanging

* Fix RPC names and output

* Format

* Fix test

* Fix tests

* Fix logic

* Remove explicit drop

* Fix hash outputs, add test

* Syntax improvements

* Fix compil feautre/evm branch (#1890)

* [WIP] EVM C++ FFI (#1884)

* C++ FFI

* Ignore unused parametar warning

* Change return type of get_chain_id()

* Use defi-config.h instead of hardcoded values

* Remove defi-config.h

---------

Co-authored-by: Shoham Chakraborty <[email protected]>

* evm: eth_mining RPC implementation (#1892)

* eth_mining RPC implementation

* Formatting

* evm: chainId RPC implementation (#1891)

* C++ FFI

* Ignore unused parametar warning

* Change return type of get_chain_id()

* eth_chainid implementation

* net_version implementation

* Fix warnings

---------

Co-authored-by: Mihailo Milenkovic <[email protected]>

* Fix build on Linux

* Removing unnecessary twice EVM lib linking

* Use MemoryAccount Default

* Rebase to master, and enable path agnostic rust builds (#1895)

* Fix typo in clang dockerfile (#1842)

* Update PULL_REQUEST_TEMPLATE.md

* mingw fixes for bcrypt, suppress depends related warnings  (#1847)

* Suppress depends related superfluous warnings

* Fix passthrough string quote

* Fix windres, bcrypt failures

* Cleanup build process and workflows (#1851)

* Suppress depends related superfluous warnings

* Fix passthrough string quote

* Fix windres, bcrypt failures

* Cleanup build, workflows, dockerfiles

* Cleanup comments

* Refactor default var setup

* Cleanup comments

* Add safe_rm_rf and simplify left file list

* Fix shellcheck

* Fix arm core images

* More cleanup, unify packaging, safer rm

* Apply default conf across all arch, conf args append

* Apply glibc compat only on linux builds

* Clean up obsolete comments

* Cleanup unmaintained deps, configs and tools (#1855)

* Suppress depends related superfluous warnings

* Fix passthrough string quote

* Fix windres, bcrypt failures

* Cleanup build, workflows, dockerfiles

* Cleanup comments

* Refactor default var setup

* Cleanup comments

* Add safe_rm_rf and simplify left file list

* Fix shellcheck

* Fix arm core images

* More cleanup, unify packaging, safer rm

* Apply default conf across all arch, conf args append

* Apply glibc compat only on linux builds

* Clean up obsolete comments

* Cleanup unmaintained files

* Remove install.md

* Remove libdeficonsensus dyn lib, defi-wallet

* Enable static linking

* Revert boost changes

* Remove outdated man pages

* Remove debian packaging related file

* Bump boost min to 1.77, remove obsolete checks

* Revert boost config cleanup

* More cleanups, nsis, gitian

* Remove boost reduce exports change

* Cleanup boost obsolete check

* Remove wallet tool test

* Update toolchains, deps and further cleanup (#1857)

* Suppress depends related superfluous warnings

* Fix passthrough string quote

* Fix windres, bcrypt failures

* Cleanup build, workflows, dockerfiles

* Cleanup comments

* Refactor default var setup

* Cleanup comments

* Add safe_rm_rf and simplify left file list

* Fix shellcheck

* Fix arm core images

* More cleanup, unify packaging, safer rm

* Apply default conf across all arch, conf args append

* Apply glibc compat only on linux builds

* Clean up obsolete comments

* Cleanup unmaintained files

* Remove install.md

* Remove libdeficonsensus dyn lib, defi-wallet

* Enable static linking

* Revert boost changes

* Remove outdated man pages

* Remove debian packaging related file

* Bump boost min to 1.77, remove obsolete checks

* Revert boost config cleanup

* More cleanups, nsis, gitian

* Remove boost reduce exports change

* Cleanup boost obsolete check

* Reorganize scripts, merge share and contrib

* Fix docker script

* Remove wallet tool test

* static libgcc, disable tests and benches on CI builds

* Fix CI builds to use consistent compilers

* Better consistency in toolchains

* Remove cdrkit, libdmg and switch to docker multiplatform base

* Update cppcheck version

* Switch libdeficonsensus to internal, toolchain cleanups  (#1860)

* Cleanup deps

* Switch libdeficonsensus to an internal lib

* Update ubuntu bases

* Update darwin llvm to 16, update cctools and all depends (#1862)

* Update toolchains

* Remove obsolete zeromq patches

* Make libtapi path agnostic of version

* Update XCode SDK

* Rename target to x86_64-apple-darwin

* Revert to older behavior of zeromq

* Remove superfluous LIBADD

* Couple LDFLAGS together

* Skip unrecognized flag on clang

* Fix unintended quote

* Overhaul of build, CI tests and lints, packaging and deps (#1880)

* Fix spv out of tree builds

* Sync dockerignore and gitignore

* Overhaul of builds (to out of tree), deps updates, simplify dockefiles, CI test, lints and more

* Uncomment benchmark code, disable with flags instead

* Resolve compiler warnings

* Fix arm64 crc intrinsics flags

* Minor CI updates and docker login fixes

* Add `--prefix` into configure to workaround surviving config.sub rechecks

* Update ignores (#1888)

* Fixes for make.sh undeclared locals and clean-artifacts (#1887)

* Fix local decls in make.sh

* Fix lints

* Actually fix lints

* Minimal change set to enable rust build

* fmt

* Include google protos to remove external dependence

* Cleanup unused vars

---------

Co-authored-by: Shoham Chakraborty <[email protected]>

* Fix sub_balance

* Refactor projects, flatten, resolve warnings (#1898)

* Rename and flatten

* cargo fix

* Resolve all warning, rename to cpp-imports

* Resolve warnings, rename to cpp-exports

* set local C to work with OSX out of the box

rm whitespaces

* Revert "set local C to work with OSX out of the box"

This reverts commit db54529.

---------

Co-authored-by: dcorral <[email protected]>

* Remove rm from makefile clean

* Revert "Remove rm from makefile clean"

This reverts commit b184807.

* Fix bench build

* Pass miner Eth address to EVM (#1904)

* Refactor rust tree into lib (#1903)

* Fix typo in clang dockerfile (#1842)

* Update PULL_REQUEST_TEMPLATE.md

* mingw fixes for bcrypt, suppress depends related warnings  (#1847)

* Suppress depends related superfluous warnings

* Fix passthrough string quote

* Fix windres, bcrypt failures

* Cleanup build process and workflows (#1851)

* Suppress depends related superfluous warnings

* Fix passthrough string quote

* Fix windres, bcrypt failures

* Cleanup build, workflows, dockerfiles

* Cleanup comments

* Refactor default var setup

* Cleanup comments

* Add safe_rm_rf and simplify left file list

* Fix shellcheck

* Fix arm core images

* More cleanup, unify packaging, safer rm

* Apply default conf across all arch, conf args append

* Apply glibc compat only on linux builds

* Clean up obsolete comments

* Cleanup unmaintained deps, configs and tools (#1855)

* Suppress depends related superfluous warnings

* Fix passthrough string quote

* Fix windres, bcrypt failures

* Cleanup build, workflows, dockerfiles

* Cleanup comments

* Refactor default var setup

* Cleanup comments

* Add safe_rm_rf and simplify left file list

* Fix shellcheck

* Fix arm core images

* More cleanup, unify packaging, safer rm

* Apply default conf across all arch, conf args append

* Apply glibc compat only on linux builds

* Clean up obsolete comments

* Cleanup unmaintained files

* Remove install.md

* Remove libdeficonsensus dyn lib, defi-wallet

* Enable static linking

* Revert boost changes

* Remove outdated man pages

* Remove debian packaging related file

* Bump boost min to 1.77, remove obsolete checks

* Revert boost config cleanup

* More cleanups, nsis, gitian

* Remove boost reduce exports change

* Cleanup boost obsolete check

* Remove wallet tool test

* Update toolchains, deps and further cleanup (#1857)

* Suppress depends related superfluous warnings

* Fix passthrough string quote

* Fix windres, bcrypt failures

* Cleanup build, workflows, dockerfiles

* Cleanup comments

* Refactor default var setup

* Cleanup comments

* Add safe_rm_rf and simplify left file list

* Fix shellcheck

* Fix arm core images

* More cleanup, unify packaging, safer rm

* Apply default conf across all arch, conf args append

* Apply glibc compat only on linux builds

* Clean up obsolete comments

* Cleanup unmaintained files

* Remove install.md

* Remove libdeficonsensus dyn lib, defi-wallet

* Enable static linking

* Revert boost changes

* Remove outdated man pages

* Remove debian packaging related file

* Bump boost min to 1.77, remove obsolete checks

* Revert boost config cleanup

* More cleanups, nsis, gitian

* Remove boost reduce exports change

* Cleanup boost obsolete check

* Reorganize scripts, merge share and contrib

* Fix docker script

* Remove wallet tool test

* static libgcc, disable tests and benches on CI builds

* Fix CI builds to use consistent compilers

* Better consistency in toolchains

* Remove cdrkit, libdmg and switch to docker multiplatform base

* Update cppcheck version

* Switch libdeficonsensus to internal, toolchain cleanups  (#1860)

* Cleanup deps

* Switch libdeficonsensus to an internal lib

* Update ubuntu bases

* Update darwin llvm to 16, update cctools and all depends (#1862)

* Update toolchains

* Remove obsolete zeromq patches

* Make libtapi path agnostic of version

* Update XCode SDK

* Rename target to x86_64-apple-darwin

* Revert to older behavior of zeromq

* Remove superfluous LIBADD

* Couple LDFLAGS together

* Skip unrecognized flag on clang

* Fix unintended quote

* Overhaul of build, CI tests and lints, packaging and deps (#1880)

* Fix spv out of tree builds

* Sync dockerignore and gitignore

* Overhaul of builds (to out of tree), deps updates, simplify dockefiles, CI test, lints and more

* Uncomment benchmark code, disable with flags instead

* Resolve compiler warnings

* Fix arm64 crc intrinsics flags

* Minor CI updates and docker login fixes

* Add `--prefix` into configure to workaround surviving config.sub rechecks

* Update ignores (#1888)

* Fixes for make.sh undeclared locals and clean-artifacts (#1887)

* Fix local decls in make.sh

* Fix lints

* Actually fix lints

* Move rust crate to lib

* Fix CI lib path

* Fix Cargo fmt

* Revert the bench change

* Switch to stable toolchain and x64 platform

* Fix stable toolchain

---------

Co-authored-by: Shoham Chakraborty <[email protected]>
Co-authored-by: jouzo <[email protected]>

* Rerun cargo build on lib change

* evm: eth_getBlockTransactionCountBy RPC implementations (#1905)

* Add blockTxCount RPCs

* Add rpcs to eth.proto

* cargo fmt

* Update src/rust/ain-grpc/src/rpc.rs

Co-authored-by: Shoham Chakraborty <[email protected]>

* Update src/rust/ain-grpc/src/rpc.rs

Co-authored-by: Shoham Chakraborty <[email protected]>

* format

* Fix by number

---------

Co-authored-by: Shoham Chakraborty <[email protected]>

* Add precommit hook (#1907)

* Fix test compilation error

* Fix pre-commit hook from blocking build

* Add cache storage layer and GetTransactionBy* RPCs (#1908)

* Add cache storage and RPC impl

* Restore block flush()

* Adding rust, protobuf into depends

* Update packages.mk, depends config

* Delegate precommit to make.sh

* evm: Save failed transactions in block (#1900)

* Save failed transactions in block

* Formatting

* Fix compiler warnings

* eth_getStorageAt and eth_getCode implementations (#1911)

* evm: Enable C++ FFI (#1912)

* Enable C++ FFI

* Rename evm_ffi to ffi_exports

* Update Makefile.am

* evm: eth_sendRawTransaction implementation (#1913)

* Move ffi files to folder, rename ffi_exports, add cxx header file

* eth_sendRawTransaction implementation

* Catch exceptions from FFI exec TX

* Add send to try block

* Fix Linux builds

* Fix eth_* RPC casing

* Ignore *.bin from persistent state

* Use a single-use context when context == 0

* Panic when wrong input format

* Change to_eth_case fallback to lowercase casing

* Use owner address as Eth miner address

* Fix test build on Linux

* Get updated owner for EVM miner if changed

* Fix make.sh git hook, unsafe complaints

* Fix commiting the test path

* Update pkg_name with correct one

* Switch to pre-commit hook to pre-push

* Fix to_eth_case for non eth_* RPCs

* Add Eth_Accounts RPC (#1916)

* Add Eth_Accounts RPC

* Return only Eth addresses in eth_accounts RPC

* Resolve issues with RPC and address behaviour (#1919)

* Simpler impl with #[rpc(server) macro

* Clippy cleanup

* Revert test changes

* Cargo fmt

* Quick fix

* Add latest fork to getblockchaininfo

* Bump regtest grpc ports to avoid conflict with devnet

* Update RPC

* Skip IsMine for destination address

* Write Eth address on creation

---------

Co-authored-by: jouzo <[email protected]>
Co-authored-by: Shoham Chakraborty <[email protected]>

* Reset fork height

* Devnet hard fork at 1,586,750

* Fix eth_call output

* Run individual Python tests via make.sh

* Fix hex import

* For mocknet use operator key as miner address

* Cleanup RPC/gRPC server codegen (#1922)

* Cleanup RPC/gRPC server codegen

* Fix warnings

* Additional cleanup and prettyplease types output

* add hashrate RPC (#1921)

* Restore load evm state on startup

* Add mc_getState RPC call to debug EVMState + cleanup

* Fix eth_hashrate

* Add mock eth_gasPrice RPC

* Add back eth_accounts logic for RPC (#1923)

* Add few example debug call

* Add evm balances to gettokenbalances (#1924)

* WIP add EVM balances to gettokenbalances

* Correct variable name

* Add feature_evm to runnable tests

* Remove combined log from test_py

* Convert WEI to Sats

* Do not try and restore inputs on an EVM TX

* Add used_gas to TxResponse

* Resolve datadir through FFI (#1925)

* Resolve datadir through FFI

* Fix format

* Create evm dir

* Fix EVM TX sending and receiving

* Check nonce in EVM TX

* Clean up rust double builds, respect debug builds

* Add cargo.toml workaround undefined symbols

* Disable unviable tests

* Cleanup

* fmt

* Implement evm RPC into test framework (#1926)

* Remove script test case that uses OP_SHA3 opcode

* Modification of test framework to connect to evm RPC, and to correctly handle evm RPC to the correct jsonrpc port on defid node

* Fix bug to not remove evm directory after initializing chain

* Fix rpc_help functional test to include evm component. Fix rust lib env_logger to direct logs to stdout instead of the default stderr.

* Create eth_rpc port and url utility functions, included chain initialization of ethrpcport inside datadir

* Revert args in test-py

* Add EVM JSON RPC port into chain param (#1929)

* New port in chain params for eth-json-rpc. includes pipeline to read new arg ethrpcport when starting node.

* Using ..50 for GRPC and ..51 for ETH JRPC

* Fix port numbers

* Update lib/ain-grpc/src/lib.rs

* Update make.sh

* Update make.sh

---------

Co-authored-by: Bushstar <[email protected]>
Co-authored-by: Prasanna Loganathar <[email protected]>

* Clean up builds.rs, separate ffi impls and stub tests

* Cleanup warnings, fmt

* evm: Rename finalize_block (#1928)

* Rename finalize_block

* Revert "Rename finalize_block"

This reverts commit efdfbc3.

* Rename FFI call

* Fixes to CI build workflows for dev, staging and production pipelines into feature/evm (#1906)

* Enable aarch64-apple-darwin builds (#1893) (#1894)

* Build pipeline for building on arm64 macOS host architecture. Included CI build workflow for building the arm64 binaries

* Rename to aarch64-apple-darwin to resolve build dependency bug

* Amended markdown documentation

(cherry picked from commit 29e10be)

* CI workflow fixes for dev, staging and production pipelines

* Fix naming bug

* Removed publishing to dockerhub pipeline in build staging workflow, and renamed "mac" to "osx"

* Added workflow to push arm build image into Dockerhub. Rename docker tag convention to differentiate arm and x64 build images.

* Fix docker tags

* Reverting changes to pushing only linux-x64 into dockerhub registry.

* Include image layer to install rust dependencies

* Install protobuf-compiler pkg dep

* bug fixes

* Fix bug in pkg_local_ensure_osx_sysroot function that does not exit out of entered dir if the package exists. Include new gnu-tar support for macos in platform_init function to support tar --transform on macos

* Install target toolchains in dockerfiles

* Fix target toolchain for linux-arm docker build

* Resolve rustc toolchain bug

* Removed optional label in proto3 syntax to fix build error

* Fix _tar func in make.sh to pass all args to gnu-tar, and fix docker release build workflow to only push x64 linux to docker registry.

* Re-order build targets to select major dev envs first.

* Fix merge errors

* Revert to feature/evm branch version

* Reverting eth.proto version to feature/evm version
t Please enter the commit message for your changes. Lines starting

* Debug fail tx

* Add exit_reason to validate_raw_tx Err

* Get block difficulty and chain work of block via CPP FFI (#1931)

* FFI: Get block difficulty and chain work of block

* Pass difficulty to finalise_block

* Do not store total_difficulty

* Move start servers to AppInitMain (#1930)

* Add EVM functional tests (#1932)

* Cleanup RPC error

* Initial functional test of EVM rpc

* Metachain JSON-RPC CLI (#1934)

* Cleanup RPC error

* Initial functional test of EVM rpc

* Metachain JSON-RPC CLI

* Format output

* Fix help message

* Move default target into build-dir

* Add missing size field to RpcBlock (#1935)

* Fix rust release build detection, build rs change detect, move types out of source (#1936)

* Cleanup make.sh

* Use gcc for depends

* Add debug-env

* Revert the rust, proto change in dockerfiles (#1937)

* fix build and make.sh script

* Update make.sh

---------

Co-authored-by: Prasanna Loganathar <[email protected]>

* evm: Transaction receipts (#1927)

* Minor make.sh cleanups

* Mark items that needs fixing

* Add git tree dirty check on hook

* Add 0x to block size

* Set block gas limit

* Resolve make check errors (#1939)

* eth_getpendingtransactions (#1933)

* WIP eth_getpendingtransactions

* Update for base branch and fmt

* Complete eth_pendingTransactions impl

* rustfmt rpc.rs

* Move code to impls.rs

* Fix errors on git push

* Resolve compile errors after merge

* Test EVM Tx showing in EVM block

* Corrections

* Cargo fmt

* Use helper functions

* evm: Update get_contract_address to return H160 (#1942)

* Change get_contract_address to return H160

* Update test

* Remove todo note

* Add beneficiary, logs_bloom and gas_used to block (#1945)

* Add deprecated mining stubs (#1943)

* fix(lib/ain-cpp-imports): conditionally specific stdlib (#1948)

* conditionally target lib based on diff os

* fmt

* use macro for conditinal compilation

* Add lab project scaffolds  (#1938)

* Add scaffold for grpc-v2

* Add flatten serde checks

* Use Request/Response convention to avoid confusion with `Result` types

* Add missing doc for RPCs

* Add 0x to block size

* Set block gas limit

* Resolve make check errors (#1939)

* eth_getpendingtransactions (#1933)

* WIP eth_getpendingtransactions

* Update for base branch and fmt

* Complete eth_pendingTransactions impl

* rustfmt rpc.rs

* Move code to impls.rs

* Fix errors on git push

* Resolve compile errors after merge

* Test EVM Tx showing in EVM block

* Corrections

* Cargo fmt

* Use helper functions

* Use untagged enums

* Cleanup, add servers

* Cleanup mod

* Add part of missing doc for proto messages

* Add missing doc for proto messages

* evm: Update get_contract_address to return H160 (#1942)

* Change get_contract_address to return H160

* Update test

* Remove todo note

* Add beneficiary, logs_bloom and gas_used to block (#1945)

* Add deprecated mining stubs (#1943)

* fix(lib/ain-cpp-imports): conditionally specific stdlib (#1948)

* conditionally target lib based on diff os

* fmt

* use macro for conditinal compilation

* Cleanup gitignore

* Add lab crates

* Enable rust build

* cargo fmt

---------

Co-authored-by: DrPing <[email protected]>
Co-authored-by: Bushstar <[email protected]>
Co-authored-by: Shoham Chakraborty <[email protected]>
Co-authored-by: Jouzo <[email protected]>
Co-authored-by: canonbrother <[email protected]>

* Use protobuf-src instead of external dep

* Remove protoc lib includes

* Resolve depends build issues

* Consolidate persistent state to BlockchainDataHandler struct (#1944)

* Consolidate persistent state to BlockchainDataHandler struct

* Update cache after cache miss

* Get receipts root before creating block

* Update deps, add protobuf-src into runtime deps

* Fix protobuf-src compilation

* Use self contained rust toolchain

* CI workflow for EVM RPC testing (#1821)

* Add workflow for testing evm rpc

* Add test workflow for EVM RPCs

* Rename EVM RPC Test

* Rename tests

* Rename workflow job

* Fix typo on environment var on CI

* Rename tag 'test/rpc_evm' to 'evm'

* Set NODE_URL to point devnet

* estimateGas and gasPrice RPC implementations (#1940)

* estimateGas and gasPrice rpc and ffi

* Remove protoc lib includes

* Resolve depends build issues

* Consolidate persistent state to BlockchainDataHandler struct (#1944)

* Consolidate persistent state to BlockchainDataHandler struct

* Update cache after cache miss

* Get receipts root before creating block

* Update deps, add protobuf-src into runtime deps

* Fix protobuf-src compilation

* Use self contained rust toolchain

* CI workflow for EVM RPC testing (#1821)

* Add workflow for testing evm rpc

* Add test workflow for EVM RPCs

* Rename EVM RPC Test

* Rename tests

* Rename workflow job

* Fix typo on environment var on CI

* Rename tag 'test/rpc_evm' to 'evm'

* Set NODE_URL to point devnet

---------

Co-authored-by: Prasanna Loganathar <[email protected]>
Co-authored-by: Jouzo <[email protected]>
Co-authored-by: dCorral <[email protected]>
Co-authored-by: canonbrother <[email protected]>

* CPP changes from master

* Restore updated test

* Fix exposed ports, env path variables (#1962)

* Remove unwrap

* Proto documentation (#1970)

* Add partial doc example for proto messages

* Add remaning doc example for proto messages

* Replace line comment by block comment

* Update doc proto messages

* Update doc proto messages

* Update doc proto messages

* Update doc proto messages

* Update doc proto messages

* Fix doc error

* Add more examples to proto messages doc and fix formating

* fix feature evm rpc tests (#1972)

* EVM State Trie (#1973)

* Debug send_raw_transaction and return RPC error when could not publish eth tx via cpp_imports (#1975)

* Add query by blockNumber RPC changes to metachain-cli (#1977)

* Remove EVMState tests

* Add latest RPC changes to CLI

* Handle full_transactions flag in getBlock* RPCs (#1976)

* Handle full_transactions flag in getBlock* RPCs

* Few RPCs type fixes

* Remove EVM block update after creation (#1978)

* Add debug log and fix NoSuchAccount error

* Don't mutate block after creation

* Refactor and rename transferbalance to transferdomain (#1966)

* Refactor transferbalance

* Rename transfer types, use intiger in rpc for type, adapt test.

* EVM RPC improvements (#1979)

* Takes eth_call input as Bytes

* Add dump_db debug RPC call

* Add clang-15 to Ubuntu build instructions

* Fix eth json RPC issue when running DFI in containerized environment (#1967)

* Change ip to 0.0.0.0

* Fix rust log output in init_runtime

* Include arg to pass address:port to bind eth rpc server

* Include pipeline to bind gRPC address to gRPC server

* Remove passing default ipv6 address to eth rpc and grpc servers

* Include rust export to pass command line args into init function, and
refactor to create init_evm_runtime function

* Fix init_evm_runtime to be called after base chain params is
initialized

* Fix clippy linter warnings

* Fix safety lint warning

* Shift unsafe init function into ain-exports lib, wraps ain-grpc init

* Fix lint

* Rebroadcast and restore failed transactions to mempool (#1965)

* Rebroadcast failed TXs

* Takes native tx as input and use it to return fail txs

* Update CPP FFI calls so code compiles

* Return failed EvmIn/Out native tx hashes

* WIP miner remove failed TXs. ConnectBlock revert failed TXs.

* Update tests for new RPC name

* Rename TransferBalance

* Miner remove coinbase fees for failed TXs

* Revert failed TransferDomain in ConnectBlock

---------

Co-authored-by: jouzo <[email protected]>

* Trickle down block timestamp to EVM (#1980)

* Merge branch 'master' into feature/evm

* Clean up after merge

* Remove unused include

* lint: correct and include RPC argument names

* lint: Update guards

* lint: remove func with locale dep

* lint: resolve Python errors

* Pay gas to miner (#1981)

* Move .vsdb to evm subfolder

* Build cleanup, enable CI, fix logs (#1982)

* Clean up build, separate rust toolchain

* Windows build fixes

* Cleanup builds, add protoc, noarch dockerfile

* lint: correct and include RPC argument names

* lint: Update guards

* lint: remove func with locale dep

* lint: resolve Python errors

* Use c style header for c compile set

* Delegate tests to makefile

* Refactor lints and run through makefile

* fmt

* Remove clang builds from CI

* Fix stable builds, fmt

* Fix build dep

* Update deps, patch vsdb, use our open forked versions

---------

Co-authored-by: Peter Bushnell <[email protected]>

* Add package hashes

* Fix default input

* Add cross compile deps

* Add second seed node

* Add seeders as pnSeeds

* Add transferdomain type to conversion table

* Update to static IP

* Change default builds to debug, fix fmt checks

* Fix warnings

* Add debug in validate raw tx

* Get private key for Eth address (#1983)

* evm: Fix receipts log output (#1985)

* Fix receipts result output

* Formatting

* Return hex encoded index

* Make logIndex index across block instead of transaction

* Formatting

* Track cumulative gas usage

* Use enumerate

* Fix build and warnings

* Coinbase placeholder Eth block hash (#1986)

* Coinbase placeholder Eth block hash

* cargo fmt

* Filter out TransferDomain TXs (#1988)

* Add vinicity to EVM execution and update on each TX (#1987)

* Remove receipt clones (#1989)

* Restore check account balance on EvmOut RPC call (#1990)

* evm: fix gas estimates (#1992)

* Do not modify gas usage in estimate_gas

* Set default gas limit to maximum

* Fix warnings

* Fix formatting

* fix cross build target os

* Fix debug format

* Downgrade block_number RPC log level to trace

* Add missing import

* Fix failing EVM tests (#1995)

* Fix EVM tests

* Change to 0x for explorer compatibility

* Remove setting of gas

* chore(test): add `eth_sendRawTransaction` test (#1998)

* add eth_sendRawTransaction test

* rm print

* move test to clean set up

* Set correct Eth block hash in coinbase TX (#1993)

* Read-only state root

* Set correct Eth block hash in coinbase TX

* Match fee to eth block

---------

Co-authored-by: jouzo <[email protected]>

* feat(lib): add rpc `eth_sendTransaction` (#1984)

* getprivkey

* getprivkey from GetWallets

* add rpc eth_sendtx

* fix cross build target os

* Change default builds to debug, fix fmt checks

* fix getchainid

* rm ffi::getprivkey, use ffi::getethprivkey

* use h160.asfixedbytes

* should use encoded signed tx

* add eth_sendTransaction test

---------

Co-authored-by: Prasanna Loganathar <[email protected]>

* Fix serialisation error

* Return correct data encoding

* Split up RPC namespaces (#2006)

* RPC: call and estimateGas at specific block height (#2005)

Co-authored-by: Shoham Chakraborty <[email protected]>

* Bump evm version and use shanghai config (#2009)

* Document ain-rs-exports FFI calls. (#2004)

Co-authored-by: Shoham Chakraborty <[email protected]>

* Check pointer is valid (#2008)

* evm: Allow failed tx in `eth_sendRawTransaction` (#2003)

* Do not validate EVM TX

* Do not skip TX validation

---------

Co-authored-by: Jouzo <[email protected]>

* Fix warning (#2010)

Co-authored-by: jouzo <[email protected]>

* Rollback latest EVM block (#2002)

* Rename to prevalidate_raw_tx

* Don't panic when restoring old code_map structure

* Fix RPC names

* Return reason for failure (#2012)

Co-authored-by: Peter Bushnell <[email protected]>

* fix(evm): fix eth block type `nonce` & `extra_data` (#2015)

* change extra_data type Vec to Bytes

* change block nonce type U256 to H64

* fix req

* CI workflow for EVM test suites (#2017)

* Include feature evm test suites into CI workflow

* Fix indentation

* Include workflow trigger when PR is made into feature/evm branch

* Fix dependency bug

* Fix superuser privileges

* fix indentation and filepath

* Separate build stage and rpc tests into different jobs

* Fix bug for running test suite

* Debug log

* add fixtures.sh

* on trigger push & target tag evm

* pump required flags for defid cmd

* Remove debug logs

* clean

* path correction & some refined

* pretty print defid

* add foundation member fixtures

* revert pretty print defid

* fix defid

* pre-note contract addr

---------

Co-authored-by: canonbrother <[email protected]>

* Fix default gas in eth_call

* state check for eth_getBlockByNumber == eth_getBlockByHash

* fix(evm): diff signer on tx2 and tx3 (#2022)

* log

* map access_list correctly

* chore(py): impr `eth_sendtx` and `eth_sendrawtx` test (#2013)

* wip

* log

* map access_list correctly

* rm pdb

* fix sendrawtx test

* refine note

* Fix publishEthTransaction catch error type

* test: fix intermittent updatemasternode test failure (#1996)

* test: add eth port to bind test (#1994)

* test: add eth port to bind test

* update loopback bind test

* lint: fix incorrectly identified dead code

* lint: remove whitespace

* lint: add expected export to first line of script

* lint: set bash before export

* lint: comment unused vars in script

* Return Eth addresses with EIP-55 checksum applied (#2024)

* Return Eth addresses with EIP-55 checksum applied

* Update src/key_io.cpp

* Fix formatting in added comments

---------

Co-authored-by: Prasanna Loganathar <[email protected]>

* fix eth checksum addr (#2028)

* test: test checksum address

* evm: Support contracts in functional tests (#2023)

* Add contract compilation and interaction to Python tests

* Fix path

* Clean up test

* Change function name

* Refactor to EVMProvider and KeyPair

* Move files to test_framework

* Add EVMProvider to TestNode

* Add static from_node method to KeyPair

* Add static from_file method to EVMContract

* Add static from_node method to EVMProvider

* Remove web3 checksum

* refactor(workflows): move `./scripts/fixtures.sh` to `.github` (#2030)

* move scripts/fixtures.sh to .github

* update bob addr to checksum addr

* Include EVM mnview in rollback. Convert miner fee to Sats. (#1999)

* Convert miner fee to Sats

* Move evm_finalize to ProcessDefi and include mnview changes in rollback

* Move EVM state changes to outside Connect/DisconnectBlock (#2032)

* Demo work in progress code

* Add iter method to keep transaction in queue instead of draining

* Remove print from test

* Rename iter to get_cloned_vec

* Use get_cloned_vec

* Update code after merge

---------

Co-authored-by: jouzo <[email protected]>

* Feature guard evm_finalize

* lint: add known local deps

* test: use arg for gas price

* test: set utf8 encoding on open

* Add web3 test dependencies (#2033)

* Install solc from make.sh

* Add pkg_install_solc to ci_setup_deps

* Install web3.py in make.sh

* Restore ProcessEVMQueue

* Make VMDomain class enum

* evm: Fix genesis block number (#2036)

* Fix block 0 generation

* Formatting

* Remove unused imports

* Refactor `transferdomain` tx (#2026)

* Refactor transferdomain message and rpc

* Add test for multiple transfer and mixed transfers

* Add comment note

* Squashed commit of the following:

commit 9cc4f21
Author: Peter John Bushnell <[email protected]>
Date:   Wed Jun 7 08:21:57 2023 +0100

    Move EVM state changes to outside Connect/DisconnectBlock (#2032)

    * Demo work in progress code

    * Add iter method to keep transaction in queue instead of draining

    * Remove print from test

    * Rename iter to get_cloned_vec

    * Use get_cloned_vec

    * Update code after merge

    ---------

    Co-authored-by: jouzo <[email protected]>

commit bba09e5
Author: Peter John Bushnell <[email protected]>
Date:   Wed Jun 7 06:52:30 2023 +0100

    Include EVM mnview in rollback. Convert miner fee to Sats. (#1999)

    * Convert miner fee to Sats

    * Move evm_finalize to ProcessDefi and include mnview changes in rollback

commit 3208586
Author: canonbrother <[email protected]>
Date:   Wed Jun 7 11:10:04 2023 +0800

    refactor(workflows): move `./scripts/fixtures.sh` to `.github` (#2030)

    * move scripts/fixtures.sh to .github

    * update bob addr to checksum addr

commit 571ae53
Author: Shoham Chakraborty <[email protected]>
Date:   Tue Jun 6 18:42:42 2023 +0800

    evm: Support contracts in functional tests (#2023)

    * Add contract compilation and interaction to Python tests

    * Fix path

    * Clean up test

    * Change function name

    * Refactor to EVMProvider and KeyPair

    * Move files to test_framework

    * Add EVMProvider to TestNode

    * Add static from_node method to KeyPair

    * Add static from_file method to EVMContract

    * Add static from_node method to EVMProvider

    * Remove web3 checksum

* Strip out validation of transferdomain as pure functions.

* Fix conversion

* Fix rpc command

* Update tests for new TransferDomain values

---------

Co-authored-by: Prasanna Loganathar <[email protected]>
Co-authored-by: Peter Bushnell <[email protected]>

* Remove unused evmrawtx call

* Add Eth addresses to getaccount (#2000)

* Add Eth addresses to getaccount

* Output tokens in order

* Revert test framework option scans

---------

Co-authored-by: Prasanna Loganathar <[email protected]>

* Fix transferdomain rpc example

* Return nonce informations to miner (#2025)

* Return nonce on evm_prevalidate_raw_tx

* Catch thrown error from evm_prevalidate_raw_tx

* Returns sender address in evm_prevalidate_raw_tx

* Check if nonce is the expected value

* Get evm nonce and balance at latest block height

* With RustRes instead of throw

* Use RustRes in evm_try_queue_tx

* Parse metadata into txMessage

* Add evm_get_nonce_in_context FFI method

* Document TransactionQueue nonce handling

* Return InvalidNonce if queued nonce is not in increasing order

* Add unit test for nonce order

* Use FFI evm_get_nonce_in_context

* Get the next valid nonce

* Track failed nonces and try them once other TXs are added

* Prevalidate all TXs with nonce > account nonce

* Test transactions added in order

* Time order mempool TXs

* Remove commented out gas check in validate raw tx

* Add more EVM TXs for test

---------

Co-authored-by: Peter Bushnell <[email protected]>

* Fix default in block_number_to_u256

* Fix Rust build

* Update call to evm_get_balance

* Discourage sending to Eth address on account layer (#2001)

* Discourage sending to Eth address on account layer

* Remove unused function and add test

* evm_discard_context removes the context queue

* Deduct EVM fee (#2039)

* Deduct fee from sender

* Prevalidate balance for MIN_GAS_PER_TX

* Additional check to prevalidate tx and tests

* evm: EIP1559 support (#2016)

* Fix block gas limit

* Fix build

* Add base_fee_per_gas to block output

* Formatting

* Calculate base fee

* Save base fee map

* eth_feeHistory implementation

* Formatting

* Fix block_count type, remove debug param

* Fix build

* Implement eth_maxPriorityFeePerGas

* Fix suggested_priority_fee loop

* Address issues

* Increase initial base fee, set minimum base fee, fix feeHistory output order

* Refactor to use match

* Use EIP1559 for eth_gasPrice estimation

* evm: Load state from genesis.json (#2034)

* Set trie state and get new state root from JSON

* Load state from input JSON

* Store genesis block after loading state from json

* Remove panic and document handlers initialization

* Add warning

* Add debug log

* WIP BLOCK

---------

Co-authored-by: jouzo <[email protected]>

* Set max gas limit per block (#2038)

* Set max gas limit per block

* Send used gas to miner in evm_prevalidate_raw_tx

* Rename to used_gas

* Get used gas from FFI

* Do not add failed TX gas to total

* Optional prevalidation of TX gas usage

---------

Co-authored-by: jouzo <[email protected]>

* Remove stub related headers

* Clippy fixes

---------

Co-authored-by: DrPing <[email protected]>
Co-authored-by: Jouzo <[email protected]>
Co-authored-by: Bushstar <[email protected]>
Co-authored-by: Shoham Chakraborty <[email protected]>
Co-authored-by: Prasanna Loganathar <[email protected]>
Co-authored-by: canonbrother <[email protected]>
Co-authored-by: jouzo <[email protected]>
Co-authored-by: dcorral <[email protected]>
Co-authored-by: dCorral <[email protected]>
Co-authored-by: Niven <[email protected]>
Co-authored-by: DrPing <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants