Skip to content

Commit

Permalink
Add EVM Engine and Rust libs (#1815)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
12 people authored Jun 9, 2023
1 parent 34c7757 commit 9ceb025
Show file tree
Hide file tree
Showing 147 changed files with 20,080 additions and 455 deletions.
69 changes: 69 additions & 0 deletions .github/scripts/fixtures.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env bash

export LC_ALL=C

# setup_var
ownerauthaddr="mwsZw8nF7pKxWH8eoKL9tPxTpaFkz7QeLU"
ownerauthpriv="cRiRQ9cHmy5evDqNDdEV8f6zfbK6epi9Fpz4CRZsmLEmkwy54dWz"
# operatorauthaddr="mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy"
operatorauthpriv="cPGEaz8AGiM71NGMRybbCqFNRcuUhg3uGvyY4TFE1BZC26EW2PkC"
alice="0x9b8a4af42140d8a4c153a822f02571a1dd037e89"
# bob="0x6C34CBb9219d8cAa428835D2073E8ec88BA0a110"
privkey_alice="af990cc3ba17e776f7f57fcc59942a82846d75833fa17d2ba59ce6858d886e23"
privkey_bob="17b8cb134958b3d8422b6c43b0732fcdb8c713b524df2d45de12f0c7e214ba35"
contract_counter="0x60c0604052600760808190526621b7bab73a32b960c91b60a090815261002891600091906100ab565b50600060025534801561003a57600080fd5b50600180546001600160a01b031916331790556040517ff15da729ec5b36e9bda8b3f71979cdac5d0f3169f8590778ac0cd82cc5cc1d4a9061009e906020808252600e908201526d2432b63637961021b7bab73a32b960911b604082015260600190565b60405180910390a161017f565b8280546100b790610144565b90600052602060002090601f0160209004810192826100d9576000855561011f565b82601f106100f257805160ff191683800117855561011f565b8280016001018555821561011f579182015b8281111561011f578251825591602001919060010190610104565b5061012b92915061012f565b5090565b5b8082111561012b5760008155600101610130565b60028104600182168061015857607f821691505b6020821081141561017957634e487b7160e01b600052602260045260246000fd5b50919050565b6103e68061018e6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80638da5cb5b116100665780638da5cb5b146100f4578063a87d942c1461011f578063c8a4ac9c14610127578063d14e62b81461013a578063ee82ac5e1461014d5761009e565b806306fdde03146100a3578063119fbbd4146100c15780631a93d1c3146100cb578063672d5d3b146100db5780638361ff9c146100e1575b600080fd5b6100ab61015f565b6040516100b891906102d5565b60405180910390f35b6100c96101ed565b005b455b6040519081526020016100b8565b436100cd565b6100cd6100ef36600461029c565b610207565b600154610107906001600160a01b031681565b6040516001600160a01b0390911681526020016100b8565b6002546100cd565b6100cd6101353660046102b4565b61026d565b6100c961014836600461029c565b610280565b6100cd61015b36600461029c565b4090565b6000805461016c9061035f565b80601f01602080910402602001604051908101604052809291908181526020018280546101989061035f565b80156101e55780601f106101ba576101008083540402835291602001916101e5565b820191906000526020600020905b8154815290600101906020018083116101c857829003601f168201915b505050505081565b6001600260008282546102009190610328565b9091555050565b6000600a8211156102695760405162461bcd60e51b815260206004820152602260248201527f56616c7565206d757374206e6f742062652067726561746572207468616e2031604482015261181760f11b606482015260840160405180910390fd5b5090565b60006102798284610340565b9392505050565b6001546001600160a01b0316331461029757600080fd5b600255565b6000602082840312156102ad578081fd5b5035919050565b600080604083850312156102c6578081fd5b50508035926020909101359150565b6000602080835283518082850152825b81811015610301578581018301518582016040015282016102e5565b818111156103125783604083870101525b50601f01601f1916929092016040019392505050565b6000821982111561033b5761033b61039a565b500190565b600081600019048311821515161561035a5761035a61039a565b500290565b60028104600182168061037357607f821691505b6020821081141561039457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220698216ef3f0a0eede3cc4f13017b1d1699d56b3aa4aa8491a3f47fc2d37ac22164736f6c63430008020033"
contract_countercaller="0x608060405234801561001057600080fd5b5060405161025c38038061025c83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6101cb806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806360598c0114610046578063a87d942c14610050578063c3da42b81461006b575b600080fd5b61004e610096565b005b6100586100f1565b6040519081526020015b60405180910390f35b60005461007e906001600160a01b031681565b6040516001600160a01b039091168152602001610062565b6000805460408051630467eef560e21b815290516001600160a01b039092169263119fbbd49260048084019382900301818387803b1580156100d757600080fd5b505af11580156100eb573d6000803e3d6000fd5b50505050565b60008060009054906101000a90046001600160a01b03166001600160a01b031663a87d942c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561014057600080fd5b505afa158015610154573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610178919061017d565b905090565b60006020828403121561018e578081fd5b505191905056fea2646970667358221220220b50dea2907d54fd36279d0583e05fe9868a78b29df0e8d111fabac5ef1d9564736f6c63430008020033"

# foundation members
./build/src/defi-cli -regtest importprivkey $ownerauthpriv owner true
./build/src/defi-cli -regtest importprivkey $operatorauthpriv operator true

# push fixtures
./build/src/defi-cli -regtest importprivkey $privkey_alice
./build/src/defi-cli -regtest importprivkey $privkey_bob
./build/src/defi-cli -regtest generatetoaddress 100 $ownerauthaddr

./build/src/defi-cli -regtest utxostoaccount '{"'"$ownerauthaddr"'":"5000@DFI"}'
./build/src/defi-cli -regtest generatetoaddress 1 $ownerauthaddr

./build/src/defi-cli -regtest setgov '{"ATTRIBUTES":{"v0/params/feature/evm":"true"}}'
./build/src/defi-cli -regtest generatetoaddress 1 $ownerauthaddr

./build/src/defi-cli -regtest transferdomain 1 '{"'"$ownerauthaddr"'":["2000@DFI"]}' '{"'"$alice"'":["2000@DFI"]}'
./build/src/defi-cli -regtest generatetoaddress 1 $ownerauthaddr

curl http://localhost:19551 \
-H 'content-type:application/json' \
--data-binary \
'{
"jsonrpc":"2.0",
"id":"fixture",
"method":"eth_sendTransaction",
"params":[{
"data":"'"$contract_counter"'",
"value":"0x00",
"gas":"0x7a120",
"gasPrice": "0x22ecb25c00"
}]
}'
./build/src/defi-cli -regtest generatetoaddress 1 $ownerauthaddr
# contract address
# 0x966aaec51a95a737d086d21f015a6991dd5559ae

curl http://localhost:19551 \
-H 'content-type:application/json' \
--data-binary \
'{
"jsonrpc":"2.0",
"id":"fixture",
"method":"eth_sendTransaction",
"params":[{
"data":"'"$contract_countercaller"'",
"value":"0x00",
"gas":"0x7a120",
"gasPrice": "0x22ecb25c00"
}]
}'
./build/src/defi-cli -regtest generatetoaddress 1 $ownerauthaddr
# contract address
# 0x007138e9d5bdb3f0b7f3abf2d46ad4f9184ef99d
2 changes: 1 addition & 1 deletion .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: GIT_VERSION=1 ./make.sh ci-export-vars

- name: Build and package
run: GIT_VERSION=1 DOCKERFILE="x86_64-pc-linux-gnu-clang" TARGET="x86_64-pc-linux-gnu" ./make.sh docker-release
run: GIT_VERSION=1 TARGET="x86_64-pc-linux-gnu" ./make.sh docker-release

- name: Publish artifact - x86_64-pc-linux-gnu
uses: actions/upload-artifact@v3
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
env:
BUILD_VERSION: latest # Computed
DOCKER_HUB_USER: defi
MAKE_DEBUG: 0

jobs:
linux-x64:
Expand All @@ -21,7 +22,7 @@ jobs:
run: GIT_VERSION=1 ./make.sh ci-export-vars

- name: Build and package
run: GIT_VERSION=1 DOCKERFILE="x86_64-pc-linux-gnu-clang" TARGET="x86_64-pc-linux-gnu" ./make.sh docker-release
run: GIT_VERSION=1 TARGET="x86_64-pc-linux-gnu" ./make.sh docker-release

- name: Publish artifacts
uses: actions/upload-artifact@v3
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/build-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Build - Staging

on:
workflow_dispatch:
release:
types: [created]

env:
MAKE_DEBUG: 0

jobs:
linux-x64:
Expand All @@ -15,7 +20,7 @@ jobs:
run: GIT_VERSION=1 ./make.sh ci-export-vars

- name: Build and package
run: GIT_VERSION=1 DOCKERFILE="x86_64-pc-linux-gnu-clang" TARGET="x86_64-pc-linux-gnu" ./make.sh docker-release
run: GIT_VERSION=1 TARGET="x86_64-pc-linux-gnu" ./make.sh docker-release

- name: Publish artifacts
uses: actions/upload-artifact@v3
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/tests-evm-rpc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Tests - EVM

on:
workflow_dispatch:
pull_request:
branches:
- feature/evm
push:
branches:
- feature/evm
tags:
- evm

env:
NODE_URL: "http://127.0.0.1:19551/"

jobs:
build-binaries:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: sudo ./make.sh pkg-install-deps && sudo ./make.sh pkg-install-llvm

- name: Build binaries
run: TARGET="x86_64-pc-linux-gnu" ./make.sh build

- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: defibins
path: |
build/src/defid
build/src/defi-cli
.github/scripts/fixtures.sh
node-rpc-tests:
runs-on: ubuntu-latest
needs: build-binaries
steps:
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: defibins

- name: Chores
run: |
chmod uog+x build/src/defid build/src/defi-cli .github/scripts/fixtures.sh
- name: Run defid node
run: |
./build/src/defid -regtest -daemon -debug=rpc -printtoconsole -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -masternode_operator=mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy -masternode_owner=mwsZw8nF7pKxWH8eoKL9tPxTpaFkz7QeLU -dummypos=0 -subsidytest=1 -txnotokens=0 -txindex=1 -amkheight=0 -bayfrontheight=1 -clarkequayheight=3 -dakotaheight=4 -dakotacrescentheight=5 -eunosheight=6 -eunospayaheight=7 -fortcanningheight=8 -fortcanningmuseumheight=9 -fortcanninghillheight=10 -fortcanningroadheight=11 -fortcanningcrunchheight=12 -fortcanningspringheight=13 -fortcanninggreatworldheight=14 -fortcanningepilogueheight=15 -grandcentralheight=16 -nextnetworkupgradeheight=17
- name: Push fixtures
run: |
sleep 5
./.github/scripts/fixtures.sh
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '^1.17.0'

- name: Set up go eth test suites library
uses: actions/checkout@v3
with:
repository: 'DeFiCh/go-ethlibs'

- name: Run EVM RPC tests
run: go test -v ./node/rpc_meta_test.go
71 changes: 71 additions & 0 deletions .github/workflows/tests-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Tests - Rust

on:
push:
paths: [ lib/** ]

pull_request:
paths: [ lib/** ]

jobs:
lint_cargo_fmt:
name: Lint (cargo fmt)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
profile: minimal
toolchain: stable
default: true
override: true
components: rustfmt, clippy

- run: |
cd lib
cargo fmt --all -- --check
lint_cargo_clippy:
name: Lint (cargo clippy)
runs-on: ubuntu-latest
steps:
- uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
profile: minimal
toolchain: stable
default: true
override: true
components: rustfmt, clippy

- run: |
cd lib
cargo clippy
test_cargo:
name: Test (cargo)
runs-on: ubuntu-latest
steps:
- uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
profile: minimal
toolchain: stable
default: true
override: true
components: rustfmt, clippy

- run: |
cd lib
cargo test --no-fail-fast
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@ contrib/devtools/split-debug.sh

# Rust local artifacts
/lib/target
*.bin
*.bin
30 changes: 29 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ if test -z "$DOXYGEN"; then
fi
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])

dnl Rust toolchain checks
AC_PATH_PROG([RUSTC], [rustc], [no])
AS_IF([test "$RUSTC" = "no"], [AC_MSG_ERROR([Rust toolchain with rustc is required])])
AC_PATH_PROG([CARGO], [cargo], [no])
AS_IF([test "$CARGO" = "no"], [AC_MSG_ERROR([Rust toolchain with cargo is required])])

AC_ARG_VAR(PYTHONPATH, Augments the default search path for python module files)

AC_ARG_ENABLE([wallet],
Expand Down Expand Up @@ -247,6 +253,7 @@ if test "x$enable_debug" = xyes; then
if test "x$CXXFLAGS_overridden" = xno; then
CXXFLAGS=""
fi
AC_SUBST(ENABLE_DEBUG,[1])

# Disable all optimizations
AX_CHECK_COMPILE_FLAG([-O0], [[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -O0"]],,[[$CXXFLAG_WERROR]])
Expand Down Expand Up @@ -1316,8 +1323,11 @@ if test x$build_defi_wallet$build_defi_cli$build_defi_tx$build_defid$use_bench$u
fi

AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin])
AM_CONDITIONAL([TARGET_NOT_DARWIN], [test x$TARGET_OS != xdarwin])
AM_CONDITIONAL([BUILD_DARWIN], [test x$BUILD_OS = xdarwin])
AM_CONDITIONAL([BUILD_NOT_DARWIN], [test x$BUILD_OS != xdarwin])
AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
AM_CONDITIONAL([TARGET_NOT_WINDOWS], [test x$TARGET_OS != xwindows])
AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes])
AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes])
AM_CONDITIONAL([ENABLE_FUZZ],[test x$enable_fuzz = xyes])
Expand Down Expand Up @@ -1396,7 +1406,22 @@ AC_SUBST(HAVE_O_CLOEXEC)
AC_SUBST(HAVE_BUILTIN_PREFETCH)
AC_SUBST(HAVE_MM_PREFETCH)
AC_SUBST(HAVE_STRONG_GETAUXVAL)
AC_CONFIG_FILES([Makefile src/Makefile test/config.ini])
AC_SUBST(PROTOC)
AC_SUBST(PROTOC_INCLUDE_DIR)

dnl If the host and build triplets are the same, we don't
dnl keep this empty
if test x$host = x$build; then
RUST_TARGET=
else
RUST_TARGET=`TARGET="$host" $ac_abs_confdir/make.sh get_rust_target`
if test x$RUST_TARGET = x; then
AC_MSG_ERROR("unsupported host target")
fi
fi
AC_SUBST(RUST_TARGET)

AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile test/config.ini])
AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh])
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])])
AC_CONFIG_LINKS([contrib/filter-lcov.py:contrib/filter-lcov.py])
Expand Down Expand Up @@ -1482,4 +1507,7 @@ echo " CXX = $CXX"
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CXXFLAGS"
echo " LDFLAGS = $PTHREAD_CFLAGS $HARDENED_LDFLAGS $GPROF_LDFLAGS $LDFLAGS"
echo " ARFLAGS = $ARFLAGS"
echo " CARGO = $CARGO"
echo " ENABLE_DEBUG = $ENABLE_DEBUG"
echo " RUST_TARGET = $RUST_TARGET"
echo
24 changes: 0 additions & 24 deletions contrib/dockerfiles/aarch64-apple-darwin.dockerfile

This file was deleted.

10 changes: 6 additions & 4 deletions contrib/dockerfiles/aarch64-linux-gnu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ LABEL org.defichain.arch=${TARGET}
WORKDIR /work
COPY ./make.sh .

RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_update_base
RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps
RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_arm64
# Temporary workaround until https://github.com/DeFiCh/ain/pull/1946 lands
# with specific ci-* methods
ENV PATH=/root/.cargo/bin:$PATH
RUN ./make.sh ci-setup-deps
RUN ./make.sh ci-setup-deps-target

COPY . .
RUN ./make.sh clean-depends && ./make.sh build-deps
RUN ./make.sh clean-conf && ./make.sh build-conf
RUN ./make.sh build-make

RUN mkdir /app && cd build/${TARGET} && \
RUN mkdir /app && cd build/ && \
make -s prefix=/ DESTDIR=/app install

# -----------
Expand Down
Loading

0 comments on commit 9ceb025

Please sign in to comment.