23 Commits
Author SHA1 Message Date
zeekay 65408996d7 Update import path 2024-01-03 09:50:41 +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
e7d9cc2f90 Precompile events - Native Minter (#963)
* add equality tests

* regenerate abis

* add extra padding tests

* override network upgrades (#839)

* override network upgrades

* genesis network upgrades defaults

* fix conflicts

* Update plugin/evm/vm.go

* update native minter

* nativeminter nit test changes

* replace fee manager packers

* remove generated abis

* Update precompile/contracts/feemanager/contract.go

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

* fix comments

* 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

* precompile event for native minter

* fixed NativeMint contract to add event

* faulty packing?

* fixed UT

* cleanups

* add get event gas cost and tests

* nits

* remove unrelated changes

* minimize diff

* add hardhat test

* fix gas in tests

* reorder event log

* add topics to GetLogData

* use interface function for testing logs

* Update contract_test.go

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

* add sender to indexed topics

* Update event.go

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

* unindex the amount in event

* Update contracts/test/contract_native_minter.ts

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

* readd after hook

* add signature topic gas costs

* add assert event func

* Update contracts/test/contract_native_minter.ts

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

* Update precompile/contracts/nativeminter/event.go

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

---------

Signed-off-by: Ceyhun Onur <[email protected]>
Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: Ceyhun Onur <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>
Co-authored-by: aaronbuchwald <[email protected]>
2023-12-21 19:43:26 +03:00
6834da19af Precompile events - Reward Manager (#961)
* 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

* set reward address precompile events

* added UT

* fixed RewardAddress gas costs

* added precompile logging for allowFeeRecipient

* added UT

* added precompile logging for disable rewards

* address code review comments

* some more fixes

* nit

* consolidated UTs

* refactored UT chainConfig creation + extra UTs

* handle D-fork for logs gas cost

* nit

* add event gas calculation to template

* add event gas costs to reward manager functions

* minor comment fix on template

* fix tests

* fix tests

* nits

* nits

* add hardhat test

* add get event gas cost and tests

* revert unrelated changes

* nits

* remove sender fields from events

* use isDUpgrade func from utils

* reorder event log

* rever reordering

* change event set log order

* add topics to GetLogData

* use interface function for testing logs

* use len instead of zero

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

* add sender to events

* use address

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

* trigger CI

* add signature topic gas costs

* add assert event func

* Update contracts/test/reward_manager.ts

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

---------

Signed-off-by: Ceyhun Onur <[email protected]>
Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: Ceyhun Onur <[email protected]>
Co-authored-by: aaronbuchwald <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>
2023-12-21 19:24:17 +03:00
2ba8bcd80e Precompile events allow list (#968)
* add equality tests

* regenerate abis

* add extra padding tests

* override network upgrades (#839)

* override network upgrades

* genesis network upgrades defaults

* fix conflicts

* Update plugin/evm/vm.go

* update native minter

* nativeminter nit test changes

* replace fee manager packers

* remove generated abis

* Update precompile/contracts/feemanager/contract.go

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

* fix comments

* 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

* wip: log allow list events

* propagated allow list events to other precompiles

* add get event gas cost and tests

* nits

* revert unrelated changes

* add allowlist events

* add topics to GetLogData

* fix dep cycle in tests

* add allowlist hardhat tests

* use len in zero assertion

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

* Update test_allowlist.go

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

* add sender to indexed topics

* Update utils.go

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

* add output names

* add signature topic gas costs

* 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

* return err

* add RoleSet event

* Update contracts/test/contract_deployer_allow_list.ts

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

* Update contracts/test/tx_allow_list.ts

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

* add assert event func

* use hash len

---------

Signed-off-by: Ceyhun Onur <[email protected]>
Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: Ceyhun Onur <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>
Co-authored-by: aaronbuchwald <[email protected]>
2023-12-21 19:05:04 +03:00
485ddc1659 Precompile events - Fee Config (#967)
* add equality tests

* regenerate abis

* add extra padding tests

* override network upgrades (#839)

* override network upgrades

* genesis network upgrades defaults

* fix conflicts

* Update plugin/evm/vm.go

* update native minter

* nativeminter nit test changes

* replace fee manager packers

* remove generated abis

* Update precompile/contracts/feemanager/contract.go

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

* fix comments

* 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

* added event for setFeeConfig

* added UT

* cleanups

* add get event gas cost and tests

* nits

* revert unrelated changes

* add event

* add hardhat test

* add topics to GetLogData

* use interface function for testing logs

* add sender to indexed topics

* Update contract.go

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

* move gas to above

* Update contracts/test/fee_manager.ts

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

* use existing test

* fix typo

* add signature topic gas costs

* fix tests

---------

Signed-off-by: Ceyhun Onur <[email protected]>
Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: Ceyhun Onur <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]>
Co-authored-by: aaronbuchwald <[email protected]>
2023-12-21 15:28:26 +00: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 0607a31ff9 Return message ID (#930)
* fix warp event packing

* add hardhat tests for warp

* remove destination fields from test

* parse from event data

* move setup to beforesuite

* add message id to events + return types

* fix test

* fix comment

* format example warp sol
2023-10-18 11:35:41 +03:00
Ceyhun OnurandGitHub e2c7037d64 add hardhat tests for warp (#935)
* fix warp event packing

* add hardhat tests for warp

* remove destination fields from test

* parse from event data

* move setup to beforesuite

* Revert "move setup to beforesuite"

This reverts commit 59abbf14432d29a6c3a82cfcb3e18badadfcd87b.

* cleanups

* move variables to definition

* remove hex checks

* use mocha conf to increase timeouts
2023-10-11 13:57:30 -07:00
CesarandGitHub eb237bc664 Remove destinationAddress and destinationChainID from Warp Message (#920)
* Remove destinationAddress and destinationChainID from Warp Message

* Use UnpackInput instead of UnpackInputIntoInterface

The generated code now matches the output of generate_procompile.sh script
2023-10-03 15:54:13 -04:00
minghinmatthewlamandGitHub 39674b87e7 Update IWarpMessenger interface name (#892) 2023-09-25 10:08:22 -07: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 23bc5703da plugin/evm: Add ExampleWarp tests to vm warp unit tests (#836)
* plugin/evm: add ExampleWarp tests to vm warp unit tests

* Update ExampleWarp contract usage

* plugin/evm: update unit test to use different source / destination addresses
2023-09-12 17:53:36 -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
aaronbuchwaldandGitHub 18e2ec3f27 contracts: fix tx allow list test func name exmaple -> example (#837) 2023-09-05 09:44:47 -07:00
Ceyhun OnurandGitHub ceee85754b update npm package (#796) 2023-08-18 10:07:20 -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
CesarandGitHub 13ad4f7091 Run ginkgo precompile tests in parallel (#712)
Use SynchronizedBeforeSuite to create the node and all the subnet that are
needed to run tests. Pass the blockchainID to each work processor and run the
tests in parallel to reduce runtime
2023-07-14 18:43:29 -04:00
aaronbuchwaldandGitHub 0257c9f393 Remove unused ethereum-waffle and ethereumjs-tx pkgs (#685) 2023-06-26 21:54:34 -04:00
a119103f19 Bump flat and hardhat in /contracts (#679)
Bumps [flat](https://github.com/hughsk/flat) to 5.0.2 and updates ancestor dependency [hardhat](https://github.com/nomiclabs/hardhat). These dependencies need to be updated together.


Updates `flat` from 4.1.1 to 5.0.2
- [Commits](https://github.com/hughsk/flat/compare/4.1.1...5.0.2)

Updates `hardhat` from 2.6.1 to 2.15.0
- [Release notes](https://github.com/nomiclabs/hardhat/releases)
- [Commits](https://github.com/nomiclabs/hardhat/compare/[email protected])

---
updated-dependencies:
- dependency-name: flat
  dependency-type: indirect
- dependency-name: hardhat
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: Hanzo Dev <[email protected]>
2023-06-17 09:05:32 -04:00
f6a86b526d Bump got and ethereum-waffle in /contracts (#680)
Removes [got](https://github.com/sindresorhus/got). It's no longer used after updating ancestor dependency [ethereum-waffle](https://github.com/EthWorks/Waffle). These dependencies need to be updated together.


Removes `got`

Updates `ethereum-waffle` from 3.4.4 to 4.0.10
- [Release notes](https://github.com/EthWorks/Waffle/releases)
- [Commits](https://github.com/EthWorks/Waffle/compare/[email protected]@4.0.10)

---
updated-dependencies:
- dependency-name: got
  dependency-type: indirect
- dependency-name: ethereum-waffle
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: Hanzo Dev <[email protected]>
2023-06-17 09:04:00 -04:00
Ceyhun OnurandGitHub 9b09e62625 Fix contract examples package json (#672)
* rename contract-examples to contracts & fix pack issue

* allow custom CMD to be run on blockchains for e2e tests

* move default hardhat test to utils

* fix comment

* add more comments

* change folder reference
2023-06-16 12:03:30 -04:00