Commit graph

7 commits

Author SHA1 Message Date
Arran Schlosberg
dc619990f5
doc: licensing of libevm additions and modifications (#34)
* doc: licensing of libevm extensions and modifications

* chore: add license headers via linter

* chore: `golangci-lint run --fix`

* chore: `golangci-lint run --fix`

* chore: fix `libevm/libevm.go` header

* chore: `s/extensions/additions/`

* chore: add missing headers
2024-09-19 21:38:26 +00:00
Arran Schlosberg
c70b3e35a1
feat: CheckConfig{Compatible,ForkOrder} + Description hooks (#29)
* feat: `CheckConfig{Compatible,ForkOrder}` + `Description` hooks

* doc: comments on `NOOPHooks` methods

* test: all new hooks

* chore: `gci`

* doc: fix `hookstest.Stub.Description` comment

Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Signed-off-by: Arran Schlosberg <519948+ARR4N@users.noreply.github.com>

---------

Signed-off-by: Arran Schlosberg <519948+ARR4N@users.noreply.github.com>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
2024-09-17 15:55:46 -04:00
Arran Schlosberg
38eaaab96c
feat!: RulesHooks.CanCreateContract() accepts and returns gas (#28)
* refactor!: `RulesHooks.CanCreateContract()` via `defer`

`TestCanCreateContract` is unchanged and merely moved to the appropriate file.

* feat!: `RulesHooks.CanCreateContract()` accepts and returns gas

* chore: move `TestCanCreateContract` to original file

Simplifies code review

* chore: pacify linter

* refactor!: revert to non-deferred call (not at start)
2024-09-17 12:14:17 -04:00
Arran Schlosberg
04543ea837
chore: golangci-lint CI workflow (#16)
* chore: `golangci-lint` CI workflow

* fix: make `golangci-lint` happy

* chore: bump `actions/{checkout,setup-go}` versions

* chore: overhaul `.golanci.yml` config

* fix: all linter issues

* chore: exclude non-libevm linters + change deprecated option

* fix: add overflow check in example

* fix: try again; different local version?

* chore: this is trying my patience

* chore: enable `gci` and fix ordering

* chore: mark `ethclient/gethclient` test as flaky

* chore: mark `eth/catalyst` test as flaky
2024-09-12 20:31:04 +01:00
Arran Schlosberg
a574ae6ef0
feat: params.ExtraPayloads.SetOnChainConfig() + Rules equiv (#14)
* feat: `params.ExtraPayloadGetter.SetOnChainConfig()` + `Rules` equiv

* refactor: rename `ExtraPayloadsGetter` to `ExtraPayloads`
2024-09-12 19:51:00 +01:00
Arran Schlosberg
d31803a0ee
refactor: params extra types are zero values not nil pointers by default (#13)
* refactor: extra types `C` + `R` are never plumbed as `*C` / `*R`

* refactor: force use of `pseudo.Constructor.Zero()` instead of `NilPointer()`

* feat: `pseudo.PointerTo()`

* feat: `params.ExtraPayloadGetter[C,R].PointerFromChainConfig(...) *C` and `Rules => *R` equiv

* test: shallow copy of `ChainConfig`/`Rules` includes extras
2024-09-12 07:54:08 +01:00
Arran Schlosberg
5429fd87c8
chore: squash arr4n/libevm into libevm (#7)
* feat: pseudo-generic extra payloads in `params.ChainConfig` and `params.Rules`

* feat: `params.ExtraPayloadGetter` for end-user type safety

* refactor: payloads only available through `params.ExtraPayloadGetter`

* chore: make `libevm/examples/extraparams` a `params` testable example

* doc: `libevm/pseudo` package comments and improved readability

* doc: `params.*Extra*` comments and improved readability

* doc: `params.ExtraPayloadGetter` comments and improved readability

* doc: `params/config.libevm_test.go` comments and improved readability

* refactor: simplify `params.ChainConfig.UnmarshalJSON()`

* refactor: abstract new/nil-pointer creation into `pseudo.Constructor`s

* feat: precompile override via `params.Extras` hooks

* doc: flesh out `PrecompileOverride()` in example

* doc: complete commentary and improve readability

* refactor: `ChainConfig.Hooks()` + `Rules` equivalent

* chore: rename precompiles test file in keeping with geth equivalent

* feat: stateful precompiles + allowlist hooks

The allowlist hooks are included in this commit because they allow for the same functionality as stateful precompiles in `ava-labs/coreth` and `ava-labs/subnet-evm`.

* fix: `StateTransition.canExecuteTransaction()` used `msg.From` instead of `To`

* test: `params.RulesHooks.CanCreateContract` integration

* test: `params.RulesHooks.CanExecuteTransaction` integration

* test: `vm.NewStatefulPrecompile()` integration

* refactor: simplify test of `CanCreateContract`

* refactor: abstract generation of random `Address`/`Hash` values

* doc: full documentation + readability refactoring/renaming

* fix: remove circular dependency in tests
2024-09-10 19:20:32 +01:00