178 Commits
Author SHA1 Message Date
zeekay 65408996d7 Update import path 2024-01-03 09:50:41 +01:00
zeekay e09f9ae0e1 Update executable to luxd 2024-01-03 09:49:05 +01:00
zeekay 3803940d43 Fix merge issues 2024-01-03 09:48:43 +01:00
zeekay f8dd36a8be Update SubnetEVM 2024-01-03 09:44:09 +01:00
a16a959e28 add event packing/unpacking to contract template (#949)
* add event packing/unpacking to contract template

* add pack event tests to template

* add event precompile bind tests

* nits

* separate event file

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

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

* revert set changes

* change event comments

* add get event gas cost and tests

* nits

* add topics to GetLogData

* Update utils.go

Signed-off-by: Ceyhun Onur <[email protected]>

* add output names

* Update precompile/testutils/test_precompile.go

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

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

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

* fix tests

* fix tests

---------

Signed-off-by: Ceyhun Onur <[email protected]>
Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: aaronbuchwald <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>
2023-12-18 18:14:43 +00:00
fe4dd6e49f verify single predicate (#960)
* verify single predicate

* simplify returned error

* track indexes for predicates

* don't short cirtcuit predicate err

* Update predicate_check.go

Signed-off-by: Ceyhun Onur <[email protected]>

* nits for single-predicate-verify (#1012)

* Update x/warp/predicate_test.go

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

* Update x/warp/predicate_test.go

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

* review fixes

* use bitset constructor

* change return type to err in verifypredicate

---------

Signed-off-by: Ceyhun Onur <[email protected]>
Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: marun <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>
Co-authored-by: aaronbuchwald <[email protected]>
2023-12-05 18:28:43 +03:00
Ceyhun OnurandGitHub c9e778f59d remove unnecessary assignment (#1015) 2023-12-04 08:35:01 -08:00
7e0b73c670 Trie stress test (#981)
* Add TrieStreeTest

This smart contract will append N new elements to a vector, this is a stress
test to our implementation of the trie structure

* Expose internal database?

* Rewrite bench

Make bench more generic and simpler to bootstrap

* Reuse functions

* Deploy contract once and reuse it

* Write full blocks

* Allow callee to deploy N contracts

Remove gas calculation from benchmarks, gas is still calculated to make sure
all contracts are deployed.

stressTestTrieDb takes 3 arguments. The number of contracts to deploy, the
calls for each block and the numbers of elements to append to the vector on
each call

* Remove all gas control

* Added AddTxOrFail()

This function will treat execution errors as errors as well, useful for
testing.

ApplyTransaction has been modified to return the ExecutionResult

* Move changes to the test

Breaking API changes should be avoided

* Improve error handling in benchmark

* Call many contracts per block

* Removed duplicate code

Use existing code instead, reading the receipt from the last execution instead
of returning the exceutionresult struct

* Use NewTx instead of NewTransaction

* Better organization for files

* rename & move files

* Update core/trie_stress_bench_test.go

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

---------

Signed-off-by: Cesar <[email protected]>
Co-authored-by: Ceyhun Onur <[email protected]>
Co-authored-by: aaronbuchwald <[email protected]>
2023-11-29 11:37:30 -05: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 ad8b8f2722 Fix tracer precompile upgrade (#979) 2023-11-03 09:08:47 +03:00
aaronbuchwaldandGitHub 06ee6b5a45 predicate: fix predicate bytes incorrect error log (#969)
* predicate: fix predicate bytes incorrect error log

* predicate: add unit test for GetPredicateResultBytes
2023-10-26 12:07:03 +03: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
Ceyhun OnurandGitHub 484ed5017c add early return (#916) 2023-09-28 09:06:37 -04:00
Stephen ButtolphandGitHub 72f6f6d377 Invalidate block when missing predicate context (#901)
* Invalidate block when missing predicate context

* Fix tests

* Update core/predicate_check.go
2023-09-27 13:49:25 -04:00
Darioush JalaliandGitHub 1c7abff2f8 NewEVMBlockContext: more explicit err path (#897)
* NewEVMBlockContext: more explicit err path

* Update core/evm.go
2023-09-27 12:57:44 -04:00
İrfan EvrensandGitHub b201e8d2f1 Fixed some golang links. (#911) 2023-09-27 10:11:03 -04:00
minghinmatthewlamandGitHub 0d0b0c94ea Consolidate predicate prepare storage slots function (#908)
* consolidate predicate prepare storage slots

* add comments
2023-09-27 11:25:57 +03:00
minghinmatthewlamandGitHub efdb422d00 Update preparePredicateStorageSlots doc (#891)
* update preparePredicateStorageSlots doc

* more specified comment for slice of byte slices
2023-09-26 20:39:06 -04:00
Darioush JalaliandGitHub 1b550eeda9 enforce warpIndex is <= MaxInt32 (#876) 2023-09-26 18:12:25 -04:00
6f60ad3b67 core/bloombits: fix deadlock when matcher session hits an error (#899)
When MatcherSession encounters an error, it attempts to close the session.
Closing waits for all goroutines to finish, including the 'distributor'.
However, the distributor will not exit until all requests have returned.

This patch fixes the issue by delivering the (empty) result to the distributor
before calling Close().

Co-authored-by: Darioush Jalali <[email protected]>
2023-09-26 18:09:31 -04:00
318a6fe09d P2p sdk pull gossip (#861)
* Add SDK Router message handling (#316)

Co-authored-by: Stephen Buttolph <[email protected]>

* Fix hanging requests after Shutdown (#326)

* fix requests hanging after shutdown

* fix build

---------

Signed-off-by: Stephen Buttolph <[email protected]>
Co-authored-by: Stephen Buttolph <[email protected]>

* Update to 1.10.10-rc.2 (#328)

* update to avalanchego 1.10.10-rc.2

* nits

* nit

* Add P2P SDK Pull Gossip (#318)

* add batchsize

* sync changes

* Drop outbound gossip for non vdrs (#862)

* Drop outbound gossip requests for non-validators (#334)

* drop outbound gossip requests for non validators

* nit

* nit

* sync changes

---------

Co-authored-by: Joshua Kim <[email protected]>

---------

Co-authored-by: Joshua Kim <[email protected]>
2023-09-19 15:09:47 -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
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
Darioush JalaliandGitHub f929f54489 Align blockchain.go trie metrics with coreth (#820) 2023-08-29 09:46:35 -04:00
Darioush JalaliandGitHub d6b2c8c6cb Adds evm t8n command line utility (#598)
* Adds the files from geth

* Fix import issues (should import subnet-evm)

* fix runner.go

* Fix some tests

* remove unused test data

* add license headers

* remove todos

* consistent language in comment

* remove random from vm context

* merge fixes

* avoid checking in binary

* fix lint

* upstream v1.12.0: other than cmd/evm/...

* update for geth v1.12.0

* add file

* remove blocktest for now

* remove logs

* remove withdrawals

* del

* Add diffs with upstream with explanation and simplify

* dead code

* fix merge
2023-08-29 09:43:54 -04:00
aaronbuchwaldandGitHub 0b646d72f3 Fix persist upgrade bytes regression (#819)
* core: add regression test for writing new upgrade bytes to disk

* core: fix write upgrades to disk regression

* Add comment documenting difference from upstream
2023-08-28 10:56:35 -04:00
aaronbuchwaldandGitHub 48cb3c379b core: add improved error log if CheckCompatible errors (#817) 2023-08-28 10:51:53 -04:00
aaronbuchwaldandGitHub 03f568ace4 core/state/snapshot: increase batch size during diffToDisk (#816) 2023-08-25 15:42:25 -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
Darioush JalaliandGitHub 11ee0540fc Serialize EffectiveGasPrice like upstream (#814) 2023-08-25 11:55:02 -04:00
Ceyhun OnurandGitHub 30391e1473 mark TestTransactionIndices as flaky (#778) 2023-08-07 15:52:41 -07: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
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 5394d11aff Remove call from precompile (#748) 2023-07-21 08:25:19 -07:00
aaronbuchwaldandGitHub f19e12dd94 Add predicate packing helper (#710)
* Add predicate packing helper

* move predicate code and add readme

* fix moved import

* fix merge
2023-07-07 15:13:09 -04:00
aaronbuchwaldandGitHub cd07a1a54a Add support for predicate gas into IntrinsicGas (#713)
* Add support for predicate gas

* Address review

* Fix test and add test for PredicateGas

* Address comments
2023-07-07 13:37:51 -04:00
aba5d764ea add blockchain.Stop as defer to test (#714)
Co-authered-by: najeal <[email protected]>
Co-authored-by: Ceyhun Onur <[email protected]>
2023-07-03 13:52:53 -07: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
80bdc65209 Add metrics for gas price / usage (#700)
Co-authored-by: aaronbuchwald <[email protected]>
2023-06-30 08:13:47 -07:00
Darioush JalaliandGitHub d922822090 remove unused line in test (#695) 2023-06-26 13:49:41 -04:00
aaronbuchwaldandGitHub 61f50a8a94 Fix core benchmarks (#697) 2023-06-24 14:51:28 -04:00
aaronbuchwaldandGitHub 50ba91df2e Bench precompile (#610)
* Add stateful precompile benchmarks

* Add GH Action for bench precompiles

* Remove coverage from benchmarks

* Rename bench workflow
2023-04-11 13:48:27 -04:00
aaronbuchwaldandGitHub 0f21037e93 Update log levels (#609) 2023-04-10 13:34:25 -04:00
aaronbuchwaldandGitHub 8ab18b8621 Rename local var validationTrieProcTime (#602) 2023-04-04 12:22:40 -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
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
aaronbuchwaldandGitHub b592052bd4 Start coreth migration (#552)
* Start coreth migration

* Bump version to v0.4.11 and avalanchego dep

* goimports core/blockchain.go

* Update compatibility.json

* Update compatibility in README

* Bump avalanchego dep to v1.9.10
2023-03-01 17:44:38 -08:00