23 Commits
Author SHA1 Message Date
zeekay 65408996d7 Update import path 2024-01-03 09:50:41 +01:00
zeekay f8dd36a8be Update SubnetEVM 2024-01-03 09:44:09 +01:00
e77c9c97cc coreth sync: 0.12.4-rc.0 -> 0.12.7 (#975)
* coreth sync: 0.12.4-rc.0 -> 0.12.7

* Review coreth 0.12.7 (#980)

* Apply suggested changes from https://github.com/ava-labs/coreth/pull/381/files

* drop reexec=0

* add txHashes

* bump avalanchego

* remove manager

* fix compat test

* bump version for e2e tests

---------

Co-authored-by: Ceyhun Onur <[email protected]>
2023-11-07 14:35:02 -05:00
Ceyhun OnurandGitHub 19a0e5bf99 move predicate package and merge with predicate utils (#907)
* add get predicate result bytes helpers

* move predicate package and merge with predicate utils

* update readme

* refactor imports & utils

* typed errs

* add comment

* fix import name

* fix stutter & same var names as pkg name

* rename functions

* fix reviews

* more rename
2023-10-02 16:55:55 -04:00
Ceyhun OnurandGitHub eb4ba695ea add get predicate result bytes helpers (#906)
* add get predicate result bytes helpers

* typed errs

* add comment
2023-09-28 17:04:16 +03:00
aaronbuchwaldandGitHub 523dcc272e Warp stapling block context (#823)
* Add GetPredicateResults to BlockContext

* Serve predicate results from blockContext

* Allow extra data to extend past DynamicFeeWindow post DUpgrade

* Get vm warp unit tests working

* Bump ANR to intermediate version to fix incompatibility with AvalancheGo

* Add kc to EthKeyChain

* Bump avalanchego dep in scripts for CI

* Add block hash payload support

* Use gomocks for precompileconfig and predicater and re-write CheckPredicates with gomocks

* Use gomock for mock accessible state and block context

* Fix existing warp contract tests with mock block context

* Remove unused mockPredicater impl

* x/warp: add contract execution unit tests

* Update NewEVMBlockContext

* Add AppendExtra to syncervm to fix tests

* x/warp: add unit test for multiple predicate results

* core: add unit test for CheckPredicates insufficient gas

* Update receive warp message test to trace block and assert the expected result

* Fix lint

* Update warp solidity contracts

* Fix block context mocks for bench

* Update precompile/precompileconfig/config.go

Co-authored-by: Darioush Jalali <[email protected]>
Signed-off-by: aaronbuchwald <[email protected]>

* Cleanup

* precompile/results: Add predicate results tests + comments

* nits

* precompile/results: omit tx predicate results if empty

* core: add invariant comment to predicate check

* Address PR comments

* Fix unpackWarpMessage and add unit tests

* Rename OriginChainID -> SourceChainID to match ago warp message type

* nits

* x/warp: set public key in warp predicate unit tests

* Update payload format

* Clarify IWarpMessenger verified message return types

* core/state: improve statedb warp specific comments

* Update input param type to uint32 to avoid potential overflow on conversion

* Update GetPredicateStorageSlots arg type to uint32

* warp/payload: add README for payload serialization (#835)

* Fix merge
2023-09-12 13:10:26 -04:00
aaronbuchwaldandGitHub a59c7b4a60 Align on a single predicate type (#813)
* Align on single predicate type

* Revert BlockContext comment change

* Update PredicateContext comment

* Address comments
2023-08-25 15:41:43 -04:00
ac6d5e1894 Update block builder to enforce predicate one tx at a time (#773)
* Update block builder to enforce predicate one tx at a time

* remove dead code

* Update miner/worker.go

Co-authored-by: Darioush Jalali <[email protected]>
Signed-off-by: aaronbuchwald <[email protected]>

---------

Signed-off-by: aaronbuchwald <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>
2023-08-02 17:37:52 -04:00
4721f3ebe2 Sync coreth v0.12.4 rc0 (#694)
* apply diff to rc0

* replace coreth with subnet-evm

* go mod tidy

* remove must commit

* remove apricots

* replace coreth with subnet-evm

* rename banff and cortina

* test memory db

* add dUpgrade

* fix errors

* sync with v0.12.4-rc0

* more diffs

* change templates

* readd preparePredicateSlots

* run goimports

* readd tx allow list check to txpool

* Fix tests

* readd subnet evm check for tests

* fix tests

* add gas limit & coinbase fakers

* Fix timestamp types

* check error from newblockchain

* fix gas limit in simulated genesis

* downgrade ci to go 1.19

* gofmt files

* rebump go to 1.20

* bump anr to latest

* bump anr to latest

* prepare predicate storage slots in Subnet-EVM

* uncomment tests

* change order of airdrop memory cleanup

* add utils import

* Coreth 0.12.4 x apply (#720)

Co-authored-by: Darioush Jalali <[email protected]>

* move instruction sets

* revert unpack changes

* reduce diffs

* move genesis verify to vm (#753)

* move genesis verify to vm

* fix comment

* set a correct default from genesis

* fix log

* revert change to vm.go

---------

Co-authored-by: Darioush Jalali <[email protected]>

* avoid adding/removing GasLimits in tests (#755)

* move genesis verify to vm

* fix comment

* set a correct default from genesis

* fix log

* revert change to vm.go

* avoid adding/removing GasLimits in tests

* nit

---------

Co-authored-by: Ceyhun Onur <[email protected]>

---------

Co-authored-by: Darioush Jalali <[email protected]>
2023-07-26 09:45:17 -04:00
80bdc65209 Add metrics for gas price / usage (#700)
Co-authored-by: aaronbuchwald <[email protected]>
2023-06-30 08:13:47 -07:00
aaronbuchwaldandGitHub 783fbbd1be Warp preparation (#573)
* Add warp precompile preparation

* Update hash slice packing

* Remove unnecessary local var

* Add VM type assertion

* Enable Warp API by default
2023-03-16 15:15:26 -04:00
d628c176f0 Precompile pre post handling (#524)
* Re-apply warp precompile interface changes

* Address nits

* Separate predicate storage slot preparation into separate function in statedb

* fix lint

* improve miner enforcePredicates comment

* Add HashSliceToBytes test case for empty slice

* Address comments

* Address comments WIP

* Pre+post handling diff for shared mem precompile

* Separate proposer and general precompile predicates

* Update ShouldVerifyWithContext to return true iff proposer predicate is specified

* Add checkPredicates unit test

* Update .gitignore

* goimports

* update

* goimports config

* Address PR review comments and improve comments

* Fix typo

* Address PR comments

* Add rules into PrepareAccessList

* Only copy bytes in preparePredicates if predicate precompile is active

* Address PR comments

---------

Co-authored-by: Darioush Jalali <[email protected]>
2023-03-16 11:34:49 -04:00
9a537aa109 state modifications as network upgrade (#549)
Co-authored-by: Aaron Buchwald <[email protected]>
2023-03-08 13:10:35 -08:00
Ceyhun OnurandGitHub d8a3e64378 Stateful Precompile Improvements (#389)
* move inline string ABIs to separate files and embed them (#383)

* move inline string ABIs to separate files and embed them

* fix tests

* fix tests

* unexport function

* Update accounts/abi/bind/bind.go

Co-authored-by: Darioush Jalali <[email protected]>

* fix func name

Co-authored-by: Darioush Jalali <[email protected]>

* replace getByKey with getByAddress (#395)

* rework on panics in precompiles (#418)

* rework on panics in precompiles

* Update precompile/allow_list.go

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

* Update precompile/fee_config_manager.go

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

* Update precompile/fee_config_manager.go

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

* fix reviews

* wrap errors in ConfigurePrecompiles

* cleaner errors

* Update utils.go

* Update miner/worker.go

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

* Update core/state_processor.go

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

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

* Precompile Specific Packages (#420)

* rework on panics in precompiles

* Update precompile/allow_list.go

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

* Update precompile/fee_config_manager.go

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

* Update precompile/fee_config_manager.go

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

* fix reviews

* wrap errors in ConfigurePrecompiles

* cleaner errors

* move reward manager precompile to package (WIP)

* rename files

* fix abi path

* move typecheck

* move precompiles to their own packages

* refactor precompile template

* remove test file

* upate comments

* rm test files

* new allowlist package

* Update precompile/utils.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update precompile/nativeminter/contract_native_minter.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update precompile/nativeminter/contract_native_minter.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update precompile/utils.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update precompile/nativeminter/contract_native_minter.go

Co-authored-by: Darioush Jalali <[email protected]>

* fix nits

Co-authored-by: aaronbuchwald <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>

* rename fee manager config struct (#427)

* rename struct

* rename fee config managers to fee managers

* fix comments

* Generalized upgrades rb (#434)

* introduce precompiles as registrable modules

* add precompile specific contract tests

* remove print debug

* add unmarshal tests

* remove unnecessary func

* fix initial disabled value

* register all modules in core/evm/contract_stateful

* more refactor & test fix

* sync template

* fix more tests

* rename file

* add comment

* rename

* fix linter

* use require error contains

* remove whitespace

* trim mock interface

* sort steps

* reviews

* Update precompile/stateful_precompile_module.go

* Update params/precompile_config.go

* Update params/precompile_config.go

* fix reviews

* add new module to configs and group module functions

* generalized-upgrades-rb review (#474)

* keep genesis disabled fix

* nits

* nits

* nit

* review fixes

* Update precompile/allowlist/allowlist.go

* use address in map

* fix linter for embedded keys

* update err messages

* more err update

* remove unnecessary function (#478)

* Start work on breaking cyclic dependency (#496)

* Update core/state_processor.go

* fix reviews

* Update precompile/contracts/txallowlist/contract_test.go

* Generalized upgrades rb nits0 (#512)

* Minor improvements

* restore readOnly

* more updates

* Add back readOnly to allow list tests

* Precompile improvements merge (#513)

Co-authored-by: aaronbuchwald <[email protected]>
Co-authored-by: Ceyhun Onur <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>
Co-authored-by: cam-schultz <[email protected]>
Co-authored-by: Matthew Lam <[email protected]>
Co-authored-by: cam-schultz <[email protected]>
Co-authored-by: omahs <[email protected]>
Co-authored-by: Anusha <[email protected]>
Co-authored-by: Hagen Hübel <[email protected]>
Co-authored-by: minghinmatthewlam <[email protected]>
Fix: typos (#428)
fix allow list comments (#469)
fix CGO flags issue (#489)
fix lint job (#499)

* review fixes

* minor nits

* fix precompile generator

* fix fee manager config test

* remove debug files

* Update core/state_processor.go

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

* fix comments

* restore statedb ordering

* fix configure in reward manager

* precompiles: adds a regression test for the IsDisabled case in AvalancheRules (#515)

* Rename configs: alternative (#520)

* alternative renaming for precompile configs

* fixes

* update naming

* rename to AllowListConfig

* simplify

* move blackhole check to module registerer (#523)

* move blackhole check to module registerer

* check blackhole first

* add unit test

* Add test case for registering module outside of reserved range

---------

Co-authored-by: Aaron Buchwald <[email protected]>

* precompile: improve test structure (#517)

* refactor precompile tests

* minor improvements

* nit

* fix merge

* rename package

* pr comments

* rm file

* merge AllowListTests

* pr comments

* explicit BeforeHook

* wspace

* Mark TestTransactionIndices flaky

---------

Co-authored-by: Aaron Buchwald <[email protected]>

* nit improvements (#529)

* nit improvements

* move comments to README

* Update cmd/precompilegen/template-readme.md

* Rename new config (#528)

* rename configurator's new config to make config

* use new built-in to create new config instance

* precompile: just nits (#534)
2023-02-22 12:27:48 -08:00
Ceyhun OnurandGitHub e973d55467 Update reward manager (#417)
* fixed block validation during reward manager deactivation

* add more comments

* Update miner/worker.go
2022-12-20 10:28:48 -05:00
a7afbfc2c4 Bump avalanchego v1.9.3 and Coreth Migration through v0.11.3 (#369)
* Migrate coreth to v0.11.3 wip

* WIP

* WIP

* migrate eth/gasprice

* update block building

* Add skip upgrade check to config

* Finish up changes

* Add ctx to tests

* Remove ported timer

* mod tidy for cmd/simulator

* Remove dead testcode

* Fix typo

* Fixes

* Fixes

* sync auto-formatted changes (#371)

* sync auto-formatted changes

* add coreth version txt

* add latest coreth version

* Update plugin/evm/block_builder.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update plugin/evm/vm.go

Co-authored-by: Darioush Jalali <[email protected]>

Co-authored-by: Ceyhun Onur <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>
2022-11-29 09:39:18 -05:00
Ceyhun OnurandGitHub c14d46dc0f Reward Manager precompile (#260)
* add initial precompile configs and handle them

* add verify to precompile configs

* add unit tests for initial configs and verify

* add a nil check for initial fee config verification

* conditionally verify allowlist

* Update precompile/stateful_precompile_config.go

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

* add config test to precompile package

* add 0 test case for gas limit

* add comments for allowlist storage keys

* move allow list role to different file

* Update precompile/allow_list.go

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

* rename test

* Update precompile/allow_list.go

Co-authored-by: Darioush Jalali <[email protected]>

* rename test & use func to create config

* Remove unnecessary role checks

* use config constructor for precompile tests

* Update accounts/abi/bind/precompile_template.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update precompile/contract_native_minter.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update precompile/contract_deployer_allow_list.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update precompile/allow_list.go

Co-authored-by: Darioush Jalali <[email protected]>

* add equals methods

* initialize reward manager precompile by precompilegen

* add reward upgrade to block verification

* handle empty case in configure

* use single field to decide allow fee recipieints

* add coinbase verification

* configure miner with coinbase in state accordingly

* Remove abis

* use header coinbase for verification

* remove hashToBool util methods

* use require and remove unneccessary address field from test

* add unit tests

* cleanups

* Update consensus/dummy/consensus.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update contract-examples/contracts/IAllowList.sol

Co-authored-by: Darioush Jalali <[email protected]>

* Update core/stateful_precompile_test.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update core/stateful_precompile_test.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update core/stateful_precompile_test.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update precompile/reward_manager.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update precompile/reward_manager.go

Co-authored-by: Darioush Jalali <[email protected]>

* Update precompile/reward_manager.go

Co-authored-by: Darioush Jalali <[email protected]>

* review fixes

* add e2e tests and example contract

* add initial config to test

* Update contract-examples/tasks.ts

Co-authored-by: Darioush Jalali <[email protected]>

* Update contract-examples/test/ExampleRewardDistributor.ts

Co-authored-by: Darioush Jalali <[email protected]>

* Update contract-examples/test/ExampleRewardDistributor.ts

Co-authored-by: Darioush Jalali <[email protected]>

* review fixes

* Update consensus/dummy/consensus.go

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

* Update params/config.go

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

* Update params/config.go

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

* fixs after review

* add string method to reward manager

* revert coinbase syntactic verification

* review fixes

* review fixes

* add disabled precompile test cases

* use hash value instead of address

* config cleanup

* Update contract-examples/tasks.ts

Co-authored-by: Darioush Jalali <[email protected]>

* Update contract-examples/tasks.ts

Co-authored-by: Darioush Jalali <[email protected]>

* more nit fixes

* fix conflict

* add disabled test case
2022-11-21 14:17:25 -05:00
Ceyhun OnurandGitHub ce7fddfba3 sync with coreth-v0.10.1 (#287)
* sync with coreth-v0.10.1

* fix generate test

* go mod tidy in simulator

* my attempt at porting corethv0.10.1

* reconcile trie

* more reconcile

* getting closer

* reduce diff

* fix

* move to blockchain api
2022-10-24 16:13:37 -04:00
Ceyhun OnurandGitHub a6d013d4ab Coreth 0.8.16 rc2 (#216)
* Unwrap ETHChain

* hook in vm.ethConfig

* statesync for subnet-evm

* remove unused configJSON

* add err check

* add synchronization

* add default config values

* delay initialization of gossiper

* Revert "add synchronization"

This reverts commit 2e8c93e58d7853de15a21ebd1460a3cd3858a6af.

* fix test

* fix statesync code prefix issue

* fix comment

* wip

* wip2

* add coreth changes

* Merge branch 'master' into coreth-0.8.16-rc2

* updates

* remove coreth from go.mod

* fix linter

* fix

* update gas prices (?)

* fix tracer test

* move dependabot yml to upper file

* more changes ported in from coreth 0.8.16

* Update sync/README.md

Co-authored-by: Ceyhun Onur <[email protected]>

* Update sync/README.md

Co-authored-by: Ceyhun Onur <[email protected]>

* Update sync/README.md

Co-authored-by: Ceyhun Onur <[email protected]>

* Update core/rawdb/accessors_state_sync.go

* port missing file from coreth

* fix-import

* subscribe before goroutine

* Rebase apply coreth diff onto statesync

* fix EOF in tests

* Nits (#265)

* Nits

* Add EIP-1559 link to readme

* Fix linting introduced by merge
2022-09-22 18:42:37 +09:00
91664ba114 init fee config precompile (#121)
* init fee config precompile

* add fee config manager precompile

* complete precompile internal functions

* nits

* add fee config provider

* init cache with limit

* added getFeeConfig func to precompile

* add fee config tasks to hardhat

* add getFeeConfigs for apis

* add unit tests

* update tx pool only if fee config is activated

* Update plugin/evm/block_verification.go

Co-authored-by: Darioush Jalali <[email protected]>

* fix for reviews

* add initial fee config to precompile & default back to chain config

* rename functions in tests

* add deployer allow list test suit

* add last accepted at

* add last accepted test to precompile test

* Revert selectBigWithinBounds changes

* use big int cmp

* move precompile test to last

* fix unit tests

* remove flaky test & ensure tx pool is reorged

* move local rpc into new file

* add comment to cachableFeeConfig

* add timestamp to block context

* add error to newOracle

* fix moar nits

* Nits

* revert allowlist setter helpers

* increase SetFeeConfigGasCost for setting last changed

* add configure validation to fee precompiles

* Address nits

* increase gas cost for wagmi

* Remove fee config from fee config manager config

* Update contract-examples/README.md

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

* add license to tests

* remove log

* add err check

* Update precompile/utils.go

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

* Remove no longer necessary test

* contract  example nits

* fix contract tests

* lower fees & split into two tests

* use explicit fees

* Nits

* feeconfig nits

* nit

* Fee config precompile nits (#145)

* Add COPYING file from geth (#83)

* Add COPYING file from geth

* Add COPYING.LESSER file

* Add version to code (#136)

* Add version to code

* bump version

* Add version to goreleaser

* Remove version from code in favor of setting at compile time

* use version env

* use v prefix in the version

Co-authored-by: Aaron Buchwald <[email protected]>

* [AV-1855] Simplify build script to place binary in avalanchego plugin directory (#81)

* Simplify build script to place binary in avalanchego plugin directory

* echo binary path

* split shutdown into network stop and client stop, call network stop
after each test, call client stop after suite ends

* add check for network up after stop

* switch to ANR

* bump script to ANR 1.1.3

* fix cluster status check

* minor fix

* cleanup of health/status check

* lint

* nits

Co-authored-by: Ceyhun Onur <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>
Co-authored-by: Aaron Buchwald <[email protected]>
2022-07-12 10:37:18 -04:00
Patrick O'Grady bb12b4ce33 limit build size 2022-04-12 08:41:15 -07:00
Aaron Buchwald d351a38527 Clean up nits 2022-02-24 14:49:41 -05:00
Patrick O'Grady f6aef56afd first commit 2021-12-15 12:28:56 -08:00