80 Commits
Author SHA1 Message Date
zeekay e22bc252cf Update deps 2024-01-03 09:52:31 +01:00
zeekay d561b4d550 Sync upstream 2024-01-03 09:52:28 +01:00
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
Dhruba BasuandGitHub 6f67474c21 Add TestSnowContext util (#1030) 2023-12-22 23:14:36 +03:00
Ceyhun OnurandGitHub 9428127238 fix pointers in err string (#1016)
* fix pointers in err string

* use ptrToString in description
2023-12-04 23:03:38 +03: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 a1c23956ad Add manager allowlist role (#801)
* update npm package

* expand allowlist.configure

* add activation func to precompile functions

* move chainconfig to precompileconfig

* use chainconfig in verification

* trim unnecessary changes

* add manager role

* fix tests

* add verify test

* nits

* add mocks

* reviews

* fix linter

* fix benchmarks

* nits

* nits

* fix alow list bind tests & ensure they're being tested (#841)

* simplify can modify check

* fix vm tests

* Add manager allowlist role merge (#850)

* 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

* x/warp: add unit test for PrimaryNetwork to Subnet predicate verification (#831)

* precompilebind: add ChainConfig with DUpgrade enabled to precompile chain config verify template
2023-09-13 09:56:57 -04:00
Ceyhun OnurandGitHub 124421fe5d override network upgrades (#839)
* override network upgrades

* genesis network upgrades defaults

* fix conflicts

* Update plugin/evm/vm.go
2023-09-12 11:28:59 -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
aaronbuchwaldandGitHub e99ce82534 Add DUpgrade extra data (#811)
* Add DUpgrade extra data

* consensus/dummy: switch to using default insteaad of fallback case
2023-08-25 12:07:18 -04:00
Ceyhun OnurandGitHub d57883fd11 Expand verify (#798)
* move chainconfig to precompileconfig

* use chainconfig in verification
2023-08-18 10:10:10 -04:00
aaronbuchwaldandGitHub 246815e95d Add warp contract implementation (#718)
* Add warp contract implementation

* Cleanup predicate test

* Fix new function signature

* Replace invalid fuzz test with unit test

* Add chain config to enable warp API for warp e2e test

* remove unused var

* Add experimental warning and move warp precompile to x/ package

* fix warning label

* Fix warning

* vm test nits

* Improve sendWarpMessenger sol comment

* more vm warp test nits

* Move warp params into params package

* More vm warp test nits

* Address more PR comments

* Remove triggerTx2

* Add check for expected topics from sendWarpMessage log

* Fix config test

* Fix incorrect replace

* remove unnecessary echo

* Address comments

* Address comments

* Address PR comments

* Improve comments

* Convert [32]byte type to common.Hash

* Add base cost for getVerifiedWarpMessage

* fix require equal type check

* Fix updated awm message format

* Update warp message format

* Move IWarpMessenger.sol to interfaces/

* Add newline to warp genesis

* uncomment assertion

* Fix broken links in README
2023-07-31 10:56:25 -04:00
Ceyhun OnurandGitHub 5ea1c86cab change sprintf verb and use values (#760) 2023-07-27 15:31:44 -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
aaronbuchwaldandGitHub 05182799b9 Add signature aggregation helpers (#711)
* Add signature aggregation helpers

* Fix

* Move WarpQuorumDenominator into new file

* Address comments

* fix var rename

* Improve comments

* Address comments
2023-07-07 14:56:58 -04:00
Ceyhun OnurandGitHub 5402fdf216 Differentiate mandatory/optional Subnet-EVM Network Upgrades (#640)
* remove network upgrades from upgrade configs and enforce them in vm init

* fix tests

* remove unused var

* remove extra shutdown

* copy test chain config when modify

* use SimulatedTestChainConfig for simulated tests

* copy modified test chain config

* add optional upgrades

* Add tests

* fix comments

* use unmarshal in test

* unexport functions

* add commented out test

* add TODO comment
2023-07-03 10:21:03 -04:00
Ceyhun OnurandGitHub 9c91cd4f0b move state upgrade related functions to own file (#684) 2023-06-26 21:58:33 -04:00
Ceyhun OnurandGitHub 13a4f51223 rename state upgrade test (#641) 2023-05-17 19:53:28 +03:00
Ceyhun OnurandGitHub 0727fbfff1 Generate precompile tests (#565)
* add verify allow list tests

* use new verify allow list suite in precompiles

* add equal test suite

* nits

* add cnfig test template

* add contract unit test generation

* Remove abis

* nits

* fix testing input in template

* Update accounts/abi/bind/precompilebind/precompile_contract_test_template.go

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

* Update accounts/abi/bind/precompilebind/precompile_contract_test_template.go

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

* Update accounts/abi/bind/precompilebind/precompile_contract_test_template.go

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

* fix non-allowlist tests
2023-05-01 11:30:07 -04: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 364486ec3a Add ChainConfig JSON Unmarshaller (#554)
* add unmarshaller

* add comments
2023-03-07 09:38:58 -05:00
427afc5457 Start release cycle v0.4.12 (#559)
* start v0.4.12 release cycle

* add setup action to lint ci for proper go version

* Bump version in plugin/evm/version.go

* Remove go version pin

* Revert "Remove go version pin"

This reverts commit e651bebbdcb51afab1291374ff5c20c4a14f20c5.

* bump golangci-lint-acion to @v3

* bump golangci lint

* try 1.48

* golangci-lint v1.51 and goimports leveldb file

* migrate linting changes from coreth

* goimports and fix diagram comments

* Fix bad goimports changes

---------

Co-authored-by: Darioush Jalali <[email protected]>
2023-03-07 09:07:17 -05:00
9b0a308ce7 add custom marshaller for GetChainConfigResponse api (#546)
* add yet another custom marshaller to GetChainConfigResponse api

* enforce a json len before allocation

* Move chain config wrapper type to params/ and add test

* Fix trailing newline

* Remove flaky unit test

* Add back unit test with JSONeq

---------

Co-authored-by: Darioush Jalali <[email protected]>
Co-authored-by: aaronbuchwald <[email protected]>
2023-03-01 16:51:39 -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
193f8040c7 add nil checks (#473)
* add nil checks

* add unit test

* use non nil config

* use non-nil configs

---------

Co-authored-by: aaronbuchwald <[email protected]>
2023-02-01 18:28:17 +03:00
Darioush JalaliandGitHub dbac226d28 nil timestamp in genesis should be upgradeable (#461)
* nil timestamp in genesis should be upgradeable

* add assert
2023-01-28 14:05:39 -05:00
Ceyhun OnurandGitHub 86d9099b4b add reward manager key string (#411) 2022-12-14 18:33:00 -05:00
minghinmatthewlamandGitHub 5ecbb913c2 Plumbing snow.Context for precompiles (#381)
* passing in snow context

* adding call and moving contractRef

* test with avalanche context

* fix import format

* dependency updates

* put snow ctx into avalanche ctx

* move back contract ref

* remove getaddress

* update go mod

* fix imports

* remove extra line

* fix pr comments

* remove call additions
2022-11-29 18:43:23 -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 5491978cd1 add prints to activating precompiles (#352)
* add prints to activating precompiles

* Update precompile_config.go

* implement stringer
2022-11-08 17:17:29 -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 bae916035d use last accepted block for check compatibility in genesis (#258)
* use last accepted block for check compatibility in genesis

* accept blocks in compatiblity test

* comment unnecessary code

* Update core/genesis.go

* Remove comment

* Update params/precompile_config.go

* Update core/genesis.go

* nits

* add regression test

* fix test

* Switch to using require in new genesis test
2022-09-23 14:13:11 +09: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
Ceyhun OnurandGitHub 042814df00 add initial precompile configs and handle them (#226)
* 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

* 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

* rename test

* Update precompile/allow_list.go

* rename test & use func to create config

* Remove unnecessary role checks

* use config constructor for precompile tests

* Update accounts/abi/bind/precompile_template.go

* Update precompile/contract_native_minter.go

* Update precompile/contract_deployer_allow_list.go

* Update precompile/allow_list.go

* add equals methods

* add new test cases for precompile configs

* use hex to address in tests

* rename helper function

* add verify to contract native minter

* add fee config tests

* add positive cases

* add equal tesets for precompile configs

* Update commontype/fee_config_test.go

* remove comment

* precompile: add formatted errors to precompile verify (#262)
2022-09-22 18:10:42 +09:00
Ceyhun OnurandGitHub 2c26de1a8d Add get chain config api (#234)
* add getUpgrades & getActivedPrecompiles API requests

* discard precompile upgrades from API if disabled

* replace GetUpgrades with GetChainConfig API

* rename active precompiles API

* remove upgrades from name

* add comments for adding new precompiles to GetActivePrecompiles
2022-08-30 09:53:42 -04:00
Ceyhun OnurandGitHub 03c9490cd8 Fee config div by zero fix (#24)
* finalise after suicide

* verify BaseFeeChangeDenominator > 1

* verify stored fee config

* remove HasSuicided

* standardize fee config verification

* Update fee_config.go

* add comment and use Finalise(true)

* add GetStoredFeeConfig Verify comments
2022-08-29 17:01:47 -04:00
c49629418a add precompile gen cmd & template (#180)
* add precompile gen cmd & template

* add comments & template

* remove unneccessary package

* Update accounts/abi/abi.go

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

* Update accounts/abi/abi.go

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

* Update accounts/abi/abi.go

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

* Update accounts/abi/abi.go

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

* Update accounts/abi/bind/precompiletemplate.go

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

* Update accounts/abi/bind/precompiletemplate.go

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

* Update params/config.go

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

* Update accounts/abi/bind/precompiletemplate.go

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

* Update accounts/abi/bind/precompiletemplate.go

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

* review fixes

* fix comment

* Update precompile/params.go

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

* Update accounts/abi/abi.go

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

* fix reviews

* use all allowlist keys to determine inheritance

* add fallback function

* add whitespace to template

* Update accounts/abi/bind/precompiletemplate.go

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

* Update accounts/abi/bind/precompiletemplate.go

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

* moar review fixes

* return immediatly when error

* rename template file

* review fixes

Co-authored-by: Darioush Jalali <[email protected]>
Co-authored-by: aaronbuchwald <[email protected]>
2022-08-16 16:53:22 -04:00
c82ac4714b enable/disable precompiles through upgradeBytes (#148)
* [wip] enable/disable precompile upgrades

* e2e json

* e2e genesis

* off by one

* omitEmpty -> omitempty

* custom json handling to avoid nested map

* simplify the config

* tx_pool: fix bug in calling IsTxAllowList

* precompile: add disable helpers

* plugin/evm: tentative UT

* precompile: move test helpers to their own file

* vm_test: fix gas / test

* fix copy/paste issue

* test fixes

* backward compatibility

* cleanup

* comment

* refactor: group NetworkUpgrades in struct

* rearrange Add/Disable helper methods

* move ethereum upgrades to chainConfig

* tx_gossiping_test: include eth upgrades

* vm_test: check for ErrSenderAddressNotAllowListed

* consensus/dummy: add clock

* TestTxAllowListDisablePrecompile: use clock

* vm_test.go: issueAndAccept helper / fixes

* vm_test: remove sleep

* support multiple activations/deactivations

* fix comment

* nit: simplify loop

* fix

* golang interfaces nil

* add some unit tests

* tests and fixes

* shutdown vm in test

* fix flakiness (AddRemoteSync)

* separate upgradeBytesConfig to its own struct

* add back wspace

* remove test helpers

* fix persitedUpgradeBytes

* make changes to embedding structure

* switch from getter to using an enum

* nit: fix strings

* upgrades_config.go -> precompile_config.go

* core: handle upgrade bytes in core.Blockchain

* nit: remove argument

* nit: less diff

* add equal check for StatefulPrecompileConfig

* split test

* upgrade_bytes_config_test -> upgrade_config_test

* revert AddRemoteSync -> addRemoteSync

* e2e tests: bump avalanche versions

* nit: remove args from run.sh in comments

* Upgrade nits (#167)

* Nits

* Nits

* Remove comment

* Fix

* Fixes

* upgradeBytes: verify increasing timestamps accross keys (#168)

* verify increasing timestamps accross keys

* nicer comparison

* Update plugin/evm/vm_upgrade_bytes_test.go

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

* unmarshal bytes to temp var

* test: reuse ctx

* test: add disable same time as enable test case

* merge (Read,Write) UpgradeConfig  w/ ChainConfig

* test disable/enable independent of timestamp

* rawdb: fix metadata accounting of upgradeConfig

* verify etherbase before genesis / minimize diff

* nit: BigNumEqual nil checks shortened version

* convert nested configs to json in String() (#175)

* Update plugin/evm/vm.go

Co-authored-by: Ceyhun Onur <[email protected]>
Co-authored-by: aaronbuchwald <[email protected]>
2022-07-30 14:28:48 -04:00
Darioush Jalali b472097b06 remove reference to [c] 2022-07-25 08:29:56 -07:00
Darioush Jalali 9e65f4e07f nit: improve some precompile comments, type checks 2022-07-25 08:18:42 -07:00
a4fd1b5a8e [AV-1898] Update [email protected] (#147)
* update versions

* Fix updated version

* use bumped ANR branch

* dep from ANR main now

* nits

Co-authored-by: Aaron Buchwald <[email protected]>
Co-authored-by: Felipe Madero <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>
2022-07-13 18:09:16 -04: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
aaronbuchwaldandGitHub 83642cf7c0 Add comments to FeeConfig (#125)
* Add comments to FeeConfig

* Address nits
2022-06-09 17:16:12 -05:00
Aaron Buchwald 22691453ab Remove omitempty from feeConfig 2022-05-24 21:50:36 -04:00
Ceyhun Onur 0c10f4f9db use value FeeConfig field in ChainConfig 2022-05-23 21:17:49 +03:00