52 Commits
Author SHA1 Message Date
zeekayandHanzo Dev 23cc6723bd Typecheck on the native compiler, keep 6 for the tools
typescript 7.0.2 is the native compiler and exports no JavaScript API, so hardhat,
ts-node and next cannot read it. Both projects take it aliased as tsgo for the
typechecking and keep typescript on the 6 line for the tools; next 16.0.1 in
particular does not recognize a bare 7 pin and runs an unsolicited
`pnpm add -D typescript` mid-build.

contracts/ reports 0 diagnostics under both compilers with strict spelled out —
TS7 turns it on by default and this config never opted in. docs/ reports the same 5
under both, once the side-effect CSS import gets the ambient declaration TS7 now
demands. Neither project had a typecheck script.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-16 22:43:54 -07:00
zeekayandHanzo Dev 9e4aa8c436 chain routes: /v1/bc -> /v1/chain
luxd serves chain routes under /v1/chain, and the node, cli and sdk releases
already ship it. The deployed gateways still answer the old prefix, so remote
reads break until they are redeployed; the estate moves together rather than
sitting half converted.

Lines that record an observation - a probe, a status code, a past release -
keep the prefix they were written against, as do URLs on hosts that are not
ours. Avalanche endpoints move to /ext/bc, which is the path that host serves.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-01 08:16:57 -07:00
zeekayandHanzo Dev 3777a375fb Restore the chain prefix the running nodes answer
The rename to /v1/chain is real in luxd source, but the deployed fleet has not
taken it yet: probed just now, api.lux.network, api.lux-test.network,
api.zoo.network and api.hanzo.network each answer 200 on /v1/bc/C/rpc and 404 on
/v1/chain/C/rpc. Composing /v1/chain against those hosts reaches nothing, which
is the failure the rename set out to prevent.

The move belongs with the node redeploy, not ahead of it.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-30 21:23:52 -07:00
zeekayandHanzo Dev 67ced027d6 chain routes: /v1/bc -> /v1/chain
luxd serves chain routes under /v1/chain; the /v1/bc prefix it replaced is
gone, so anything composing it reaches nothing. Lines that record an
observation - a probe, a status code, a past release - keep the prefix they
were written against, as do URLs on hosts that are not ours.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-30 20:55:38 -07:00
zeekay d6f2202a4f docs: chain routes are /v1/chain
luxd serves chain APIs under one segment from constants.ChainAliasPrefix
(constants v1.6.4, node v1.36.181):

  /v1/bc/<alias>/...   -> /v1/chain/<alias>/...
  /ext/bc/<alias>/...  -> /v1/chain/<alias>/...

Observations keep their original addresses: a dated note or a recorded status
code is a fact about when it was written, not an instruction to follow.
2026-08-30 17:12:20 -07:00
zeekayandHanzo Dev e8187ae5a5 Dial /v1, the only prefix luxd serves
luxd pins baseURL="/v1" (node/server/http/server.go:33) and has never
served /ext, so both exported constructors — plugin/evm/client.NewClient
and warp.NewClient — built a path no node answers. They are the seam
every out-of-tree caller goes through: cli/pkg/utils/staking.go,
sdk/validatormanager/uptime.go and netrunner/api all hand them a bare
node URI, and staking.go's own SplitRPCURI already parsed /v1/bc/<id>/rpc.
Those callers were already on /v1; this package was the lagging outlier,
so fixing it here fixes all of them without touching one.

Also corrects the simulator's default websocket endpoint, the hardhat
default, and the docs — including api.testnet.lux.network, which does not
serve RPC at all. The testnet host is api.lux-test.network (chainId
0x17870). Prefix-only sweeps miss that class of error.

Tests pin the constructed path against an httptest server, with both an
alias and a blockchain ID, so a future prefix change fails loudly instead
of silently 404ing in production.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 19:07:09 -07:00
zeekayandHanzo Dev 1a5185588a build: migrate tsconfig to TypeScript 7 (native compiler)
TypeScript 7 is the native Go compiler and removes `baseUrl` and
`moduleResolution: node|node10`. Both appear here, so `tsc` from TS7
refuses the config outright (TS5102 / TS5108) and cannot typecheck.

`paths` targets resolve relative to `baseUrl` when it is set and relative
to the tsconfig file otherwise. Every `baseUrl` folded here already
pointed at the config's own directory, so dropping it moves nothing and
the targets are left byte-identical. Where a baseUrl pointed elsewhere,
each affected target was rewritten as join(baseUrl, target).

`moduleResolution` was chosen from the declared `module`: commonjs ->
node16, esnext/preserve -> bundler. Configs whose `module` is unset or
exotic were left alone rather than guessed at.

The result is accepted by BOTH toolchains, so nothing has to upgrade
TypeScript in lockstep. Verified on hanzo/chat packages/api: tsc 5.9
779 -> 778 errors (no regression), and tsc 7.0.2 now runs the project
in 2s where it previously refused the config.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 14:18:45 -07:00
zeekayandHanzo Dev 5beb54cdb7 stakeweight: name the per-nodeID replay guard the tally owes
A ballot is replayable by construction — the same bytes verify every time —
so hasVoted[proposalId][nodeID] is the only thing between a validator and
counting its weight twice. Keyed by nodeID, never by address.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 13:37:21 -07:00
zeekayandHanzo Dev c56386b415 stakeweight: make P-chain stake a usable on-chain vote weight
P-chain stake is not natively readable from the C-chain EVM, and the obvious
fix — a precompile that reads the validator set in Run() — is consensus-fatal.
The BlockContext handed to Run() (precompile/contract/interfaces.go:63) carries
Number, Timestamp and GetPredicateResults, and nothing else; a validator-set
read from there would have to use the node's own current P-chain height
(node vms/platformvm/validators/manager.go:214 getCurrentHeight ->
state.GetLastAccepted), so two honest nodes executing the same block a second
apart would compute different weights and fork the chain.

The one place a P-chain height IS agreed is predicate verification:
Block.VerifyWithContext passes ProposerVMBlockCtx.PChainHeight to
VerifyPredicate (plugin/evm/block.go:283), the pass/fail bitset is written into
the header (miner/worker.go:514) and re-checked on replay
(plugin/evm/block.go:366). A ballot verified there is a consensus-committed
fact, and historical sets stay reconstructible from P-chain weight diffs.

So the ballot CLAIMS a weight and the predicate refuses any overstatement:
  weight <= weightAt(ballot.pChainHeight)  - no flash-stake
  weight <= weightAt(block.pChainHeight)   - no exited or shrunken validator
  totalWeight == totalAt(snapshot)         - the denominator is exact
Under-claiming is always allowed, so a voter never has to predict which block
its transaction lands in.

The unit of weight is the validator, and it already includes delegations: the
P-chain keeps one weight per nodeID and folds each delegator into it
(node vms/platformvm/state/state_validators.go:570,582 — AddStaker(own stake)
then AddWeight(each delegator) under the same key). One map entry per nodeID is
what makes double-counting a delegation impossible. Delegators do not get a
separate ballot; their override is exit, which needs no code.

Authorisation reuses the BLS key the P-chain already binds to the nodeID, so
there is no registry to capture, no admin to hold it and no key ceremony. The
signature covers (domain, chainID, nodeID, voter, authEpoch) only — a standing
authorisation, reusable for every later proposal, rotated by signing a strictly
greater epoch.

Uptime is deliberately not a gate: it is absent from GetValidatorOutput and is
a per-node subjective measurement (all five mainnet validators report
uptime 0.0000 through the public API), so no deterministic rule can read it.

Proven against a read-only fork of mainnet 96369 — the real five-validator set,
real registered BLS keys, real 5e17/2.5e18 weights — including that no ballot
is accepted for any of them without the operator's key.

Address 0x0200...0006 is the next free slot after warp; eth_getCode on 96369
returns 0x for it and 0x01 for warp, so predicates are already live there.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 13:36:21 -07:00
zeekay 5d0b9d9f65 fix: LUX_MNEMONIC → MNEMONIC (generic) 2026-04-01 16:48:22 -07:00
zeekay d32e075809 refactor: update to vm v1.0.18, migrate log and metrics packages
- Update vm dependency to v1.0.18
- Remove internal log package in favor of luxfi/log
- Migrate prometheus to gatherer package
2026-01-11 21:38:34 -08:00
zeekay 4b7da04687 Use luxfi/math/math instead of geth/common/math 2026-01-03 17:37:03 -08:00
zeekay 162e4f6668 refactor: remove all SubnetEVM references and backward compatibility
- Rename plugin/evm/upgrade/subnetevm package to feewindow
- Rename SubnetEVMTimestamp to EVMTimestamp (JSON: evmTimestamp)
- Rename IsSubnetEVM method to IsEVM
- Rename SubnetEVMDefaultChainConfig to EVMDefaultChainConfig
- Rename TestSubnetEVMChainConfig to TestEVMChainConfig
- Rename TestPreSubnetEVMChainConfig to TestPreEVMChainConfig
- Rename ethclient/subnetevmclient to ethclient/evmclient
- Update VM factory ID from "subnetevm" to "evm"
- Remove all backward compatibility aliases
- Update all documentation and comments

Breaking change: This removes all SubnetEVM naming - only "EVM" is supported.
No backward compatibility maintained as per user requirement.
2025-12-21 10:26:52 -08:00
zeekay efd9479da6 Fix CI: Remove non-existent @luxfi/luxjs package
- Remove @luxfi/luxjs from contracts/package.json (package doesn't exist)
- Regenerate package-lock.json with correct dependencies
- NPM clean install now passes
- Hardhat compilation works correctly
2025-09-19 05:08:41 +00:00
zeekay ff82f8284a Update to latest geth, so on 2025-08-04 02:23:56 -05:00
zeekay b1979b4a02 Update EVM 2025-08-01 01:23:42 +00:00
zeekay 19fe8dc2c7 Replace ethereum/go-ethereum references with luxfi/geth
- Updated go:generate comments to use luxfi/geth instead of ethereum/go-ethereum
- Fixed GitHub issue/PR references to point to luxfi repositories
- Updated comments referencing the Lux geth fork
- Part of the migration to unified EVM architecture with Lux consensus
2025-07-23 17:34:24 -05:00
zeekay 8a4d08e0ae Re-organize consensus 2025-07-21 22:01:01 -05:00
zeekay 7d8b52af3f Update copyrights properly 2025-07-21 21:10:03 -05:00
zeekay 8da155c1b1 Update imports 2025-07-18 01:55:16 +00:00
zeekay 5bde5ae476 fix: resolve merge conflicts in test files
- Fixed merge conflicts in precompile_config_test.go
- Fixed merge conflicts in block_test.go
- Fixed merge conflicts in test_statedb.go
2025-07-17 16:44:45 -05:00
zeekay 4ac513dba4 Merge upstream subnet-evm v0.7.5
Merged latest upstream changes from ava-labs/subnet-evm v0.7.5 while preserving Lux customizations:
- Updated copyright headers to Lux Industries Inc 2025
- Kept Lux branding and network references
- Preserved custom Lux configurations
- Updated dependencies to latest versions
- Removed deprecated files (trie/, core/vm/, etc)
- Updated import paths to use go-ethereum libraries where applicable
2025-07-03 23:56:17 -04:00
zeekay 1d04d6d04f Update copyright headers to Lux Industries Inc 2025
Updated all copyright headers from "Lux Partners Limited" to "Lux Industries Inc" and updated the year to 2025 to reflect the new holding company structure.
2025-07-03 23:49:31 -04:00
265ea52751 Bump axios from 1.7.2 to 1.8.4 in /contracts (#1525)
Signed-off-by: dependabot[bot] <[email protected]>

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

Co-authored-by: Hanzo Dev <[email protected]>
2025-03-28 14:15:34 +00:00
65fc39f38e Bump undici from 5.28.4 to 5.29.0 in /contracts (#1524)
Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: Hanzo Dev <[email protected]>
2025-03-27 21:41:48 +00:00
Ceyhun OnurandGitHub a03d7a7261 update tsconfig & bump to 1.2.2 (#1199) 2024-06-04 18:35:37 +00:00
Ceyhun OnurandGitHub 1d1c38e9bc bump js dependencies (#1193)
* bump dependencies

* bump node version in CI

* update build script
2024-05-29 13:15:02 +03:00
Ceyhun OnurandGitHub 616533416b E upgrade config (#1135)
* introduce e upgrade

* map upgrades

* check if upgrade is non-nil

* fix checkForks

* Fix tests

* revert test changes

* fix tests

* remove block no param from IsCancun

* add UT

* use avalanche defaults for timestamps

* use non-zero timestamps in genesis configs

* fix test timestamps

* add timestamp to ethapi genesis

* fix blockchain test genesis timestamp

* fix test

* review fixes
2024-05-01 15:31:49 +03:00
Ceyhun OnurandGitHub 1132c7e0b9 bump npm versions (#1070) 2024-01-29 11:05:08 +03:00
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