Skip to content

Commit

Permalink
[FEATURE] Berlin hard fork (#106)
Browse files Browse the repository at this point in the history
* EIP-2565 Implementation (0xPolygon#1704)

* implemented EIP-2565

* fixed linting error

* fixed linting error

* fixed TestModExpWithEIP2565

* resolved comments

* resolved comments

* resolved merge conflicts

* Eip 2929 (0xPolygon#1748)

* implemented changes for EIP-2929 (access list)

* added missing files

* fixed unit test Test_opCall

* populate access_list with precompiles only if eip-2929 is activated

* added address to access list for Balance opcode

* added test cases and for EIP-2929 and also call stack output

* changed structure of access list and removed some comments

* fixed linting errors

* fixed AddSlot method

* added test cases for access list

* removed call stack output for Test_Transition_EIP2929

* corrected indentation

* fixed linting errors

* fixed linting errors

* fixed Test_opReturnDataCopy

* removed ActivePrecompile Address slice

* changed the const name

* changed the const name in comments

* change the AddAddress function to a variadic function

* refactored

* added test cases for SLOAD opcode

* fixed linting errors

* refactored code

* resolved merge conflicts

* fixed EIP-2929 test

* Rebase fix

* `Berlin` fork implementation (#81)

* Berlin implementation

* Fix tests

* Lint fix

* Lint fix part 2

* Bug fixes

* Lint fix

* Legacy e2e tests fix

* Unmarshal fix

* Tx signer fix

* Use requires instead of Fatalf

* Pass the TestLondonSignerSender

* Cleanup precompile addresses

* TxSigner fix

* Fix precompiles addresses access in unit test

* Order tx types

* Address comments

---------

Co-authored-by: Stefan Negovanović <[email protected]>

* Rebase fix

* Berlin fixes (#86)

* Add journal to contract access list changes

* small fix on journal

* remove access list from state

* Fix build

* Remove commented code

* Add access list to state_test_util

* Include BerlinToLondon tests as well

* Minor change

---------

Co-authored-by: Stefan Negovanović <[email protected]>

* Use `btcec v2` lib for `ECDSA` keys manipulation (#105)

* Use btcec v2 lib for ECDSA keys manipulation

* Fix test

* Remove key from stake manager

* Warning fix (loop variable capture)

* Bump Ethereum tests version (#119)

* Bump Ethereum tests version

* Linter fixes

* Skip loopMul and minor refactoring

* Refactor Ethereum tests files resolution

* Provide EIP 3607 to each fork config

* Audit duration of each test

* Add detailed logging and skip CREATEBlake2f_MaxRounds test

* Remove -v flag

* small fixes

* fix

* Lint fix

---------

Co-authored-by: Goran Rojovic <[email protected]>

* London test fixes (#111)

* Tests fixes

* SelfDestruct fix

* Rebase fix

* Journaling fix

* Tests fix

* e2e fix

* subGasLimit fix

* Fix

* Skip CheckEIP1559 e2e test

* Remove auxState field from Transition and use NewTransition function

* increase timeout for UT

* Suppress linting warnings

* underflow test fix

* Revert make file

* Remove panic

* Use %d in the error formatting

---------

Co-authored-by: Stefan Negovanović <[email protected]>

---------

Co-authored-by: Rachit Sonthalia <[email protected]>
Co-authored-by: Goran Rojovic <[email protected]>
Co-authored-by: Goran Rojovic <[email protected]>
  • Loading branch information
4 people authored Feb 19, 2024
1 parent 599a104 commit 1bcd34a
Show file tree
Hide file tree
Showing 100 changed files with 3,455 additions and 1,438 deletions.
13 changes: 7 additions & 6 deletions blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ func (b *Blockchain) writeBody(batchWriter *storage.BatchWriter, block *types.Bl

// Write txn lookups (txHash -> block)
for _, txn := range block.Transactions {
batchWriter.PutTxLookup(txn.Hash, block.Hash())
batchWriter.PutTxLookup(txn.Hash(), block.Hash())
}

return nil
Expand All @@ -1020,7 +1020,7 @@ func (b *Blockchain) ReadTxLookup(hash types.Hash) (types.Hash, bool) {
// return error if the invalid signature found
func (b *Blockchain) recoverFromFieldsInBlock(block *types.Block) error {
for _, tx := range block.Transactions {
if tx.From != types.ZeroAddress || tx.Type == types.StateTx {
if tx.From() != types.ZeroAddress || tx.Type() == types.StateTx {
continue
}

Expand All @@ -1029,7 +1029,7 @@ func (b *Blockchain) recoverFromFieldsInBlock(block *types.Block) error {
return err
}

tx.From = sender
tx.SetFrom(sender)
}

return nil
Expand All @@ -1041,18 +1041,19 @@ func (b *Blockchain) recoverFromFieldsInTransactions(transactions []*types.Trans
updated := false

for _, tx := range transactions {
if tx.From != types.ZeroAddress || tx.Type == types.StateTx {
if tx.From() != types.ZeroAddress || tx.Type() == types.StateTx {
continue
}

sender, err := b.txSigner.Sender(tx)
if err != nil {
b.logger.Warn("failed to recover from address in Tx", "hash", tx.Hash, "err", err)
b.logger.Warn("failed to recover from address in Tx", "hash", tx.Hash(), "err", err)

continue
}

tx.From = sender
tx.SetFrom(sender)

updated = true
}

Expand Down
Loading

0 comments on commit 1bcd34a

Please sign in to comment.