Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default values on init #503

Conversation

piersy
Copy link
Contributor

@piersy piersy commented Feb 10, 2025

Description

Tests

Additional context

Metadata

marekolszewski and others added 30 commits January 31, 2025 14:38
Adding funding.json, required for retroPGF application.
This will make it work on non-x86 platforms via emulation.
* Add renovate.json

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* renovate: Disable all but security updates

---------

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Paul Lange <[email protected]>
This keeps compatibility with the Celo L1, so that both core contracts
and third party contracts will be able to do fresh deploys after the L2
migration. If we want to go the Ethereum's value, it is better done
some time after the L2 migration to avoid having many breaking changes
at the same time.
We changed the value and the test fail for that reason. Some tests could
be updated, but I didn't get them to pass right away. So I'm going the
quick way for now and skip all problematic tests.
For binding generation and initialization of the `--dev` mode.
This will be the hardfork used to enable all Celo
related features in the op-geth.
e2e_test: Use shell based test runner

* Run all test_* files
* Report failure count
* Handle geth start and stop
* Use initialized genesis block instead of deploying token
* Validations for celo txs in txpool

* Add stateDB usage for celo validation

* CRU

* Change method name && hardcode true for iswhitelisted for tests

* fix wrong negation

* Fix lint
To exercise the fee currency support and test JS lib compatibility.

Closes celo-org/optimism#61
Modifies the legacypool, list, and priceheap to allow for multi currency txs.
piersy and others added 29 commits February 3, 2025 12:10
The code previously assumed that all non pending transactions passed
to newRPCTransaction would have a receipt, but in fact this is not the
case because recorded bad blocks have no receipts.

The only transaction type that relied on having a receipt is the
CeloDynamicFeeTxV2Type which post cel2 stores the base fee in fee
currency in the receipt which allows for calculating the gas price without
state access.

So we fix the panic by simply allowing post cel2 CeloDynamicFeeTxV2Type
to not have a receipt, and if they don't returning nil for the gas price.

Closes celo-org/celo-blockchain-planning#747
This commit reinstates a custom l1 cost function for Alfajores which always
returns zero.

We thought we could get rid of this by simply setting the l1 fee scalars to
zero, but we missed the l1 blob fee scalars on alfajores so removing our custom
l1 cost function causes a hardfork while syncing alfajores.

In order to remove our l1 cost function without introducing an unintentional
hardfork, we'll need to have a hardfork so that we can switch off the use of
the cost function at a certain point. But for now reinstating our custom cost
function means that we can use this branch for our alfajores deployment. This
saves us having to manage two separate branches (one for local development
and one to be deployed on alfajores).
Adds an e2e smoketest that sends value transfer, contract interaction
and contract creation transactions for all of the valid transaction types.

It also verifies that deprecated transactions (celo legacy & cip42) are
not supported.

Co-authored-by: Karl Bartel <[email protected]>
* Fix gas estimator for txs with feeCurrency + Value

---------

Co-authored-by: Maximilian Langenfeld <[email protected]>
Fixes celo-org/celo-blockchain-planning#720

This PR replaces the current RLP encoding/decoding of 'BeforeGingerbreadHeader' and 'AfterGingerbreadHeader' from reflection style function to auto generated function by `rlpgen`.

For code generation, `BeforeGingerbreadHeader` and `AfterGingerbreadHeader` are renamed from `beforeGingerbreadHeader` and `afterGingerbreadHeader`

---------

Co-authored-by: piersy <[email protected]>
We can fix and reenable them after the rebase.
* Fix failing e2e tests in test_viem_tx

* Add timeout for some failing tests

* Add comments about new sleep in e2e test

* Add sleep in test_token_duality

* Revert adding sleep in e2e tests

* Fix price coefficient of tx which can't be replaced in test_viem_tx e2e test
* Add TestSmokeRPCCompatibilities for RPC compatibility smoke test

* Fix upper bound of random value in TestSmokeRPCCompatibilities

* Add reset totalDifficulty of L1 block in TestSmokeRPCCompatibilities

* Fix comment

* Fix comment

* Revert incorrect reset of totalDifficulty for L1 block data in TestSmokeRPCCompatibilities

* Add codes to make sure block 0 and 1 are tested in TestSmokeRPCCompatibilities
Github plans to End of Life version 3 of actions/upload-artifact
next month and this will break all workflows not upgraded to version 4

Co-authored-by: pputman12 <[email protected]>
This changes the way that we detect pre-gingerbread headers when encoding.

Closes celo-org/celo-blockchain-planning#588

Previously we would interpret a `gasLimit` of zero to indicate pre-gingerbread headers, since prior to the gingerbread hardfork celo blocks lacked the `gasLimit` field.

This however caused lots of problems with the go tests (existing and ones that continue to be added) that routinely use blocks where gasLimit has not been set.

So now we detect pre-gingerbread blocks when decoding and set a flag on the struct that is used to select the encoding.
New blocks are assumed to be post gingerbread, which is ok because it's not possible to run op-geth without gingerbread set, because we haven't ported across the pre-gingerbread state transition logic.

I was able to revert some test modifications because of this but this didn't fix the tests that broke during the celo11 rebase (skipped in [this commit](d981efb)), it seems like those problems were caused by something else.
Updates header encoding/decoding

A new field 'RequestsHash' was added to the header, and we needed to run
go generate to regenerate the generated encoding/decoding. We also
needed to update celo_block.go to account for the new field.

Simplified the encoding and decoding in celo_block.go by simply casting
the header into the right type for encoding/decoding. This ensures that
we won't need to update celo_block.go in the future when fields are
added or removed.

These changes allowed us to unskip the tests that were skipped during the celo11 rebase.

Fixes celo-org/celo-blockchain-planning#854
Updates generated code and adds a CI step to check
that generated types are up to date.

Co-authored-by: Karl Bartel <[email protected]>
Before the `GetAddresses` function silently returned the
mainnet addresses as a default value, without the caller
being made aware of this.

Now, the `GetAddresses` function will return `nil` whenever
it does not explicitly maps the passed in chain-id to a set
of addresses.

The newly added `GetAddressesOrDefault` function allows for
retrieving the addresses with a default fallback for
easier use in inline calls. This replicates the behavior
of the old `GetAddresses` functionality with more verbosity.
* Invalidate txs with below base-fee-floor gas-price in txpool

Fixes #291

Before, the transaction pool accepted transactions that have a
gas-price below the configured base-fee-floor, which would never be
executed.

Now, the transaction pool rejects those transactions immediately -
giving the submitting user an immediate response and better UX.

* Add check for effective-gas-tip reaches min-tip in txpool validation

* Make genesis devmode alloc function public

* Allocate Celo balance also for fundedAccount in genesis

* Add test for celo-legacypool

* Use stateful legacypool validation in test

* Fix error/panic messages

* Fix min-tip conversion in txpool pre-validation

Fixes #304

* Add tests for min-tip validation in txpool

* Summarize common fixtures to default vars in txpool test

* Fix typo
#306)

* Add unit test for Celo Tx JSON marshaling

Format imports

Add test for CeloDenominatedTx

* Add unit test for Celo Tx JSON unmarshaling

* Add unit test for Celo Tx RLP encoding/decoding

* format and clean up unit tests for Celo Tx JSON marshaling/unmarshaling

* Replace assert.NoError with require.NoError

* Adds checks for presence of feeCurrency and maxFeeInFeeCurrency fields during unmarshalling of CeloDenominatedTx
* Add unit test for GetBlockReceipt JSON-RPC API

* Adds a few comments
* [WIP] Retrieve baseFee and gasLimit for pre gingerbread block in RPC request

* Add codes to store pre gingerbread block's base fee and gas limit into KVS

* Add tests

* Format code

* Format code

* Fix test

* Fix test

* Add retrievePreGingerbreadGasLimit to resolve broken tests

* Add test comments

* Add tests for PopulatePreGingerbreadHeaderFields and retrievePreGingerbreadBlockBaseFee"

* Fix lint error

* Fix lint error

* Remove gas limit field from pre-Gingerbread additional fields record in local DB

* Replace some assert with require in tests

* Format codes based on review

* Clean up codes

* Remove unnecessary new line

* Fix typo
Don't mention bedrock, but the L2 migration
ActivePrecompiles referenced a global variable named PrecompiledAddressesCel2
from multiple goroutines without any synchronisation. This PR fixes that by
making PrecompiledAddressesCel2 a local variable within ActivePrecompiles.

This also looks like it is a fix for the bad blocks we had been seeing by
causing the ActivePrecompiles return value to lack some of our active
precompiles, which in turn would lead to them not being pre-warmed in the
access list, which would result in them costing an extra 2500 gas when executed
for the first time in a transaction. (Thank you to @Kourin1996 & @karlb for
figuring this out!)


See the data race trace below.

op-geth-1  | WARNING: DATA RACE
op-geth-1  | Read at 0x0000040a7920 by goroutine 651651:
op-geth-1  |   github.com/ethereum/go-ethereum/core/vm.ActivePrecompiles()
op-geth-1  |       github.com/ethereum/go-ethereum/core/vm/contracts.go:257 +0x35c
op-geth-1  |   github.com/ethereum/go-ethereum/core.(*StateTransition).innerTransitionDb()
op-geth-1  |       github.com/ethereum/go-ethereum/core/state_transition.go:600 +0x190
op-geth-1  |   github.com/ethereum/go-ethereum/core.(*StateTransition).TransitionDb()
op-geth-1  |       github.com/ethereum/go-ethereum/core/state_transition.go:550 +0x148
op-geth-1  |   github.com/ethereum/go-ethereum/core.ApplyMessage()
op-geth-1  |       github.com/ethereum/go-ethereum/core/state_transition.go:250 +0x608
op-geth-1  |   github.com/ethereum/go-ethereum/core.precacheTransaction()
op-geth-1  |       github.com/ethereum/go-ethereum/core/state_prefetcher.go:90 +0xac
op-geth-1  |   github.com/ethereum/go-ethereum/core.(*statePrefetcher).Prefetch()
op-geth-1  |       github.com/ethereum/go-ethereum/core/state_prefetcher.go:69 +0x640
op-geth-1  |   github.com/ethereum/go-ethereum/core.(*BlockChain).insertChain.func3()
op-geth-1  |       github.com/ethereum/go-ethereum/core/blockchain.go:1842 +0x11c
op-geth-1  |   github.com/ethereum/go-ethereum/core.(*BlockChain).insertChain.gowrap2()
op-geth-1  |       github.com/ethereum/go-ethereum/core/blockchain.go:1848 +0x78
op-geth-1  | 
op-geth-1  | Previous write at 0x0000040a7920 by goroutine 651491:
op-geth-1  |   github.com/ethereum/go-ethereum/core/vm.ActivePrecompiles()
op-geth-1  |       github.com/ethereum/go-ethereum/core/vm/contracts.go:257 +0x368
op-geth-1  |   github.com/ethereum/go-ethereum/core.(*StateTransition).innerTransitionDb()
op-geth-1  |       github.com/ethereum/go-ethereum/core/state_transition.go:600 +0x190
op-geth-1  |   github.com/ethereum/go-ethereum/core.(*StateTransition).TransitionDb()
op-geth-1  |       github.com/ethereum/go-ethereum/core/state_transition.go:550 +0x148
op-geth-1  |   github.com/ethereum/go-ethereum/core.ApplyMessage()
op-geth-1  |       github.com/ethereum/go-ethereum/core/state_transition.go:250 +0x608
op-geth-1  |   github.com/ethereum/go-ethereum/core.ApplyTransactionWithEVM()
op-geth-1  |       github.com/ethereum/go-ethereum/core/state_processor.go:132 +0x4e8
op-geth-1  |   github.com/ethereum/go-ethereum/core.(*StateProcessor).Process()
op-geth-1  |       github.com/ethereum/go-ethereum/core/state_processor.go:92 +0x9cc
op-geth-1  |   github.com/ethereum/go-ethereum/core.(*BlockChain).processBlock()
op-geth-1  |       github.com/ethereum/go-ethereum/core/blockchain.go:1934 +0x3b4
op-geth-1  |   github.com/ethereum/go-ethereum/core.(*BlockChain).insertChain()
op-geth-1  |       github.com/ethereum/go-ethereum/core/blockchain.go:1853 +0x2cd8
op-geth-1  |   github.com/ethereum/go-ethereum/core.(*BlockChain).InsertChain()
op-geth-1  |       github.com/ethereum/go-ethereum/core/blockchain.go:1625 +0xde0
op-geth-1  |   github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).importBlockResults()
op-geth-1  |       github.com/ethereum/go-ethereum/eth/downloader/downloader.go:771 +0x6f4
op-geth-1  |   github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).processFullSyncContent()
op-geth-1  |       github.com/ethereum/go-ethereum/eth/downloader/downloader.go:742 +0xa8
op-geth-1  |   github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).syncToHead.func8()
op-geth-1  |       github.com/ethereum/go-ethereum/eth/downloader/downloader.go:537 +0x2c
op-geth-1  |   github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).spawnSync.func1()
op-geth-1  |       github.com/ethereum/go-ethereum/eth/downloader/downloader.go:549 +0x90
* Add totalDifficulty field to JSON-RPC response for Celo1 header & block

* Fix test

* Remove new line

---------

Co-authored-by: piersy <[email protected]>
…ansactions (#308)

* Fix typo

* Add unit tests for forks

* Add unit tests for Celo signer

* Format code

* Simplify Test_forks_activeForks and Test_forks_findTxFuncs

* Remove Test_forks_findTxFuncs
* Add error for no migrated data in bootstrapping

* Move migrated data existence check into backend and add a new condition for full sync node

* Improve error message for missing Celo1 blocks
The underlying command has been removed upstream:
53f66c1
@piersy piersy closed this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.